mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 06:11:35 +00:00
generalize SourceAnalyzer to handle all defs with bodies
This commit is contained in:
parent
07cc047b4f
commit
5471c1ef4b
3 changed files with 51 additions and 11 deletions
|
@ -305,6 +305,30 @@ mod tests {
|
|||
kind: Method,
|
||||
detail: "pub fn blah(&self)"
|
||||
}
|
||||
]"###
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_completion_works_in_consts() {
|
||||
assert_debug_snapshot_matches!(
|
||||
do_ref_completion(
|
||||
r"
|
||||
struct A { the_field: u32 }
|
||||
const X: u32 = {
|
||||
A { the_field: 92 }.<|>
|
||||
};
|
||||
",
|
||||
),
|
||||
@r###"[
|
||||
CompletionItem {
|
||||
label: "the_field",
|
||||
source_range: [106; 106),
|
||||
delete: [106; 106),
|
||||
insert: "the_field",
|
||||
kind: Field,
|
||||
detail: "u32"
|
||||
}
|
||||
]"###
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue