mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-29 21:35:20 +00:00
Revert "feat: Implement module_path
macro"
This commit is contained in:
parent
095926ea6f
commit
fa48bc216c
20 changed files with 71 additions and 278 deletions
|
@ -24,11 +24,9 @@ pub(crate) fn goto_type_definition(
|
|||
let file: ast::SourceFile = sema.parse_guess_edition(file_id);
|
||||
let token: SyntaxToken =
|
||||
pick_best_token(file.syntax().token_at_offset(offset), |kind| match kind {
|
||||
IDENT | INT_NUMBER | T![self] => 3,
|
||||
// operators
|
||||
T!['('] | T!['['] | T!['{'] | T![')'] | T![']'] | T!['}'] | T![!] | T![?] => 2,
|
||||
kind if !kind.is_trivia() => 1,
|
||||
_ => 0,
|
||||
IDENT | INT_NUMBER | T![self] => 2,
|
||||
kind if kind.is_trivia() => 0,
|
||||
_ => 1,
|
||||
})?;
|
||||
|
||||
let mut res = Vec::new();
|
||||
|
|
|
@ -8702,68 +8702,3 @@ fn foo() {
|
|||
"#]],
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn module_path_macro() {
|
||||
check(
|
||||
r##"
|
||||
//- minicore: module_path
|
||||
|
||||
const C$0: &'static str = module_path!();
|
||||
"##,
|
||||
expect![[r#"
|
||||
*C*
|
||||
|
||||
```rust
|
||||
test
|
||||
```
|
||||
|
||||
```rust
|
||||
const C: &'static str = "test"
|
||||
```
|
||||
"#]],
|
||||
);
|
||||
check(
|
||||
r##"
|
||||
//- minicore: module_path
|
||||
|
||||
mod foo {
|
||||
const C$0: &'static str = module_path!();
|
||||
}
|
||||
"##,
|
||||
expect![[r#"
|
||||
*C*
|
||||
|
||||
```rust
|
||||
test::foo
|
||||
```
|
||||
|
||||
```rust
|
||||
const C: &'static str = "test::foo"
|
||||
```
|
||||
"#]],
|
||||
);
|
||||
check(
|
||||
r##"
|
||||
//- minicore: module_path
|
||||
mod baz {
|
||||
const _: () = {
|
||||
mod bar {
|
||||
const C$0: &'static str = module_path!();
|
||||
}
|
||||
}
|
||||
}
|
||||
"##,
|
||||
expect![[r#"
|
||||
*C*
|
||||
|
||||
```rust
|
||||
test::bar
|
||||
```
|
||||
|
||||
```rust
|
||||
const C: &'static str = "test::baz::bar"
|
||||
```
|
||||
"#]],
|
||||
);
|
||||
}
|
||||
|
|
|
@ -69,7 +69,6 @@ pub(crate) fn status(db: &RootDatabase, file_id: Option<FileId>) -> String {
|
|||
dependencies,
|
||||
origin,
|
||||
is_proc_macro,
|
||||
..
|
||||
} = &crate_graph[crate_id];
|
||||
format_to!(
|
||||
buf,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue