mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-30 22:01:37 +00:00
Don't complete paths after attributes
This commit is contained in:
parent
9ea6ee6b27
commit
11115ebad8
7 changed files with 151 additions and 163 deletions
|
@ -20,6 +20,7 @@ pub(crate) enum ImmediatePrevSibling {
|
|||
TraitDefName,
|
||||
ImplDefType,
|
||||
Visibility,
|
||||
Attribute,
|
||||
}
|
||||
|
||||
/// Direct parent "thing" of what we are currently completing.
|
||||
|
@ -113,6 +114,7 @@ pub(crate) fn determine_prev_sibling(name_like: &ast::NameLike) -> Option<Immedi
|
|||
} else {
|
||||
return None
|
||||
},
|
||||
ast::Attr(_it) => ImmediatePrevSibling::Attribute,
|
||||
_ => return None,
|
||||
}
|
||||
};
|
||||
|
@ -438,4 +440,9 @@ mod tests {
|
|||
fn test_vis_prev_sibling() {
|
||||
check_prev_sibling(r"pub w$0", ImmediatePrevSibling::Visibility);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_attr_prev_sibling() {
|
||||
check_prev_sibling(r"#[attr] w$0", ImmediatePrevSibling::Attribute);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue