generalize SourceAnalyzer to handle all defs with bodies

This commit is contained in:
Aleksey Kladov 2019-04-11 16:22:10 +03:00
parent 07cc047b4f
commit 5471c1ef4b
3 changed files with 51 additions and 11 deletions

View file

@ -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"
}
]"###
);
}