mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 06:11:35 +00:00
Don't complete non-macro item paths in impls and modules
This commit is contained in:
parent
30948e1ecb
commit
f41c983424
6 changed files with 76 additions and 29 deletions
|
@ -92,9 +92,15 @@ fn test_has_ref_parent() {
|
|||
}
|
||||
|
||||
pub(crate) fn has_item_list_or_source_file_parent(element: SyntaxElement) -> bool {
|
||||
match not_same_range_ancestor(element) {
|
||||
Some(it) => it.kind() == SOURCE_FILE || it.kind() == ITEM_LIST,
|
||||
None => true,
|
||||
let it = element
|
||||
.ancestors()
|
||||
.take_while(|it| it.text_range() == element.text_range())
|
||||
.last()
|
||||
.map(|it| (it.kind(), it.parent()));
|
||||
match it {
|
||||
Some((_, Some(it))) => it.kind() == SOURCE_FILE || it.kind() == ITEM_LIST,
|
||||
Some((MACRO_ITEMS, None) | (SOURCE_FILE, None)) => true,
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
#[test]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue