Don't complete paths after attributes

This commit is contained in:
Lukas Wirth 2021-06-16 18:50:18 +02:00
parent 9ea6ee6b27
commit 11115ebad8
7 changed files with 151 additions and 163 deletions

View file

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