mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 06:11:35 +00:00
Mention that generated .adocs are generaterd
This commit is contained in:
parent
0b2b9a5508
commit
b82d967182
5 changed files with 26 additions and 21 deletions
|
@ -3,7 +3,7 @@
|
|||
use std::{fmt, fs, path::Path};
|
||||
|
||||
use crate::{
|
||||
codegen::{self, extract_comment_blocks_with_empty_lines, Location, Mode},
|
||||
codegen::{self, extract_comment_blocks_with_empty_lines, reformat, Location, Mode, PREAMBLE},
|
||||
project_root, rust_files, Result,
|
||||
};
|
||||
|
||||
|
@ -15,7 +15,7 @@ pub fn generate_assists_tests(mode: Mode) -> Result<()> {
|
|||
pub fn generate_assists_docs(mode: Mode) -> Result<()> {
|
||||
let assists = Assist::collect()?;
|
||||
let contents = assists.into_iter().map(|it| it.to_string()).collect::<Vec<_>>().join("\n\n");
|
||||
let contents = contents.trim().to_string() + "\n";
|
||||
let contents = format!("//{}\n{}\n", PREAMBLE, contents.trim());
|
||||
let dst = project_root().join("docs/user/generated_assists.adoc");
|
||||
codegen::update(&dst, &contents, mode)
|
||||
}
|
||||
|
@ -134,7 +134,7 @@ r#####"
|
|||
|
||||
buf.push_str(&test)
|
||||
}
|
||||
let buf = crate::reformat(buf)?;
|
||||
let buf = reformat(buf)?;
|
||||
codegen::update(&project_root().join(codegen::ASSISTS_TESTS), &buf, mode)
|
||||
}
|
||||
|
||||
|
|
|
@ -3,14 +3,14 @@
|
|||
use std::{fmt, fs, path::PathBuf};
|
||||
|
||||
use crate::{
|
||||
codegen::{self, extract_comment_blocks_with_empty_lines, Location, Mode},
|
||||
codegen::{self, extract_comment_blocks_with_empty_lines, Location, Mode, PREAMBLE},
|
||||
project_root, rust_files, Result,
|
||||
};
|
||||
|
||||
pub fn generate_feature_docs(mode: Mode) -> Result<()> {
|
||||
let features = Feature::collect()?;
|
||||
let contents = features.into_iter().map(|it| it.to_string()).collect::<Vec<_>>().join("\n\n");
|
||||
let contents = contents.trim().to_string() + "\n";
|
||||
let contents = format!("//{}\n{}\n", PREAMBLE, contents.trim());
|
||||
let dst = project_root().join("docs/user/generated_features.adoc");
|
||||
codegen::update(&dst, &contents, mode)?;
|
||||
Ok(())
|
||||
|
|
|
@ -14,7 +14,7 @@ use ungrammar::{rust_grammar, Grammar, Rule};
|
|||
|
||||
use crate::{
|
||||
ast_src::{AstEnumSrc, AstNodeSrc, AstSrc, Cardinality, Field, KindsSrc, KINDS_SRC},
|
||||
codegen::{self, update, Mode},
|
||||
codegen::{self, reformat, update, Mode},
|
||||
project_root, Result,
|
||||
};
|
||||
|
||||
|
@ -61,7 +61,7 @@ fn generate_tokens(grammar: &AstSrc) -> Result<String> {
|
|||
}
|
||||
});
|
||||
|
||||
let pretty = crate::reformat(quote! {
|
||||
let pretty = reformat(quote! {
|
||||
use crate::{SyntaxKind::{self, *}, SyntaxToken, ast::AstToken};
|
||||
#(#tokens)*
|
||||
})?
|
||||
|
@ -261,7 +261,7 @@ fn generate_nodes(kinds: KindsSrc<'_>, grammar: &AstSrc) -> Result<String> {
|
|||
}
|
||||
}
|
||||
|
||||
let pretty = crate::reformat(res)?;
|
||||
let pretty = reformat(res)?;
|
||||
Ok(pretty)
|
||||
}
|
||||
|
||||
|
@ -383,7 +383,7 @@ fn generate_syntax_kinds(grammar: KindsSrc<'_>) -> Result<String> {
|
|||
}
|
||||
};
|
||||
|
||||
crate::reformat(ast)
|
||||
reformat(ast)
|
||||
}
|
||||
|
||||
fn to_upper_snake_case(s: &str) -> String {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue