mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 20:42:04 +00:00
Get rid of $crate
in expansions shown to the user
Be it "Expand Macro Recursively", "Inline macro" or few other things. We replace it with the crate name, as should've always been.
This commit is contained in:
parent
94b526fc86
commit
cfb701ac78
15 changed files with 396 additions and 64 deletions
|
@ -1162,7 +1162,7 @@ pub mod tokens {
|
|||
|
||||
pub(super) static SOURCE_FILE: LazyLock<Parse<SourceFile>> = LazyLock::new(|| {
|
||||
SourceFile::parse(
|
||||
"const C: <()>::Item = ( true && true , true || true , 1 != 1, 2 == 2, 3 < 3, 4 <= 4, 5 > 5, 6 >= 6, !true, *p, &p , &mut p, async { let _ @ [] })\n;\n\nimpl A for B where: {}", Edition::CURRENT,
|
||||
"use crate::foo; const C: <()>::Item = ( true && true , true || true , 1 != 1, 2 == 2, 3 < 3, 4 <= 4, 5 > 5, 6 >= 6, !true, *p, &p , &mut p, async { let _ @ [] })\n;\n\nimpl A for B where: {}", Edition::CURRENT,
|
||||
)
|
||||
});
|
||||
|
||||
|
@ -1188,6 +1188,17 @@ pub mod tokens {
|
|||
.unwrap()
|
||||
}
|
||||
|
||||
pub fn crate_kw() -> SyntaxToken {
|
||||
SOURCE_FILE
|
||||
.tree()
|
||||
.syntax()
|
||||
.clone_for_update()
|
||||
.descendants_with_tokens()
|
||||
.filter_map(|it| it.into_token())
|
||||
.find(|it| it.kind() == CRATE_KW)
|
||||
.unwrap()
|
||||
}
|
||||
|
||||
pub fn whitespace(text: &str) -> SyntaxToken {
|
||||
assert!(text.trim().is_empty());
|
||||
let sf = SourceFile::parse(text, Edition::CURRENT).ok().unwrap();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue