Address comments

This commit is contained in:
Arthur Baars
2024-09-24 14:09:23 +02:00
parent 7b4137fbc8
commit d14e77ba48
6 changed files with 13 additions and 2 deletions

View File

@@ -9,7 +9,7 @@ pub mod trap;
use ra_ap_syntax::ast::SourceFile; use ra_ap_syntax::ast::SourceFile;
use ra_ap_syntax::AstNode; use ra_ap_syntax::AstNode;
pub fn extract( fn extract(
archiver: &archive::Archiver, archiver: &archive::Archiver,
traps: &trap::TrapFileProvider, traps: &trap::TrapFileProvider,
file: std::path::PathBuf, file: std::path::PathBuf,

View File

@@ -0,0 +1 @@
/generated.rs linguist-generated

View File

@@ -1,3 +1,5 @@
//! Generated by `cargo generate-schema`, do not edit by hand.
use super::base::{TextValue, Translator}; use super::base::{TextValue, Translator};
use crate::generated; use crate::generated;
use crate::trap::{Label, TrapId}; use crate::trap::{Label, TrapId};

View File

@@ -53,6 +53,10 @@ fn write_schema(
super_types: BTreeMap<String, BTreeSet<String>>, super_types: BTreeMap<String, BTreeSet<String>>,
) -> std::io::Result<String> { ) -> std::io::Result<String> {
let mut buf: Vec<u8> = Vec::new(); let mut buf: Vec<u8> = Vec::new();
writeln!(
buf,
"# Generated by `cargo generate-schema`, do not edit by hand.\n"
)?;
writeln!(buf, "from .prelude import *\n")?; writeln!(buf, "from .prelude import *\n")?;
for node in &grammar.enums { for node in &grammar.enums {
@@ -404,7 +408,8 @@ fn write_extractor(grammar: &AstSrc) -> std::io::Result<String> {
let mut buf: Vec<u8> = Vec::new(); let mut buf: Vec<u8> = Vec::new();
writeln!( writeln!(
buf, buf,
"use crate::generated; "//! Generated by `cargo generate-schema`, do not edit by hand.\n
use crate::generated;
use super::base::{{TextValue, Translator}}; use super::base::{{TextValue, Translator}};
use crate::trap::{{Label, TrapId}}; use crate::trap::{{Label, TrapId}};
use ra_ap_syntax::ast; use ra_ap_syntax::ast;

1
rust/schema/.gitattributes vendored Normal file
View File

@@ -0,0 +1 @@
/ast.py linguist-generated

2
rust/schema/ast.py generated
View File

@@ -1,3 +1,5 @@
# Generated by `cargo generate-schema`, do not edit by hand.
from .prelude import * from .prelude import *
class AssocItem(AstNode): class AssocItem(AstNode):