mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-30 13:51:31 +00:00
fix: Fix token downmapping failing for include! inputs
This commit is contained in:
parent
fb832ff2ba
commit
d878b8caad
6 changed files with 125 additions and 41 deletions
|
@ -497,6 +497,44 @@ fn func_in_include() {
|
|||
//^^^^^^^^^^^^^^^
|
||||
}
|
||||
|
||||
fn foo() {
|
||||
func_in_include$0();
|
||||
}
|
||||
"#,
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn goto_def_in_included_file_inside_mod() {
|
||||
check(
|
||||
r#"
|
||||
//- minicore:include
|
||||
//- /main.rs
|
||||
mod a {
|
||||
include!("b.rs");
|
||||
}
|
||||
//- /b.rs
|
||||
fn func_in_include() {
|
||||
//^^^^^^^^^^^^^^^
|
||||
}
|
||||
fn foo() {
|
||||
func_in_include$0();
|
||||
}
|
||||
"#,
|
||||
);
|
||||
|
||||
check(
|
||||
r#"
|
||||
//- minicore:include
|
||||
//- /main.rs
|
||||
mod a {
|
||||
include!("a.rs");
|
||||
}
|
||||
//- /a.rs
|
||||
fn func_in_include() {
|
||||
//^^^^^^^^^^^^^^^
|
||||
}
|
||||
|
||||
fn foo() {
|
||||
func_in_include$0();
|
||||
}
|
||||
|
|
|
@ -2750,4 +2750,25 @@ impl Foo {
|
|||
"#]],
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn goto_ref_on_included_file() {
|
||||
check(
|
||||
r#"
|
||||
//- minicore:include
|
||||
//- /lib.rs
|
||||
include!("foo.rs");
|
||||
fn howdy() {
|
||||
let _ = FOO;
|
||||
}
|
||||
//- /foo.rs
|
||||
const FOO$0: i32 = 0;
|
||||
"#,
|
||||
expect![[r#"
|
||||
FOO Const FileId(1) 0..19 6..9
|
||||
|
||||
FileId(0) 45..48
|
||||
"#]],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue