internal: Lift out item list path completions from (un)qualified_path

This commit is contained in:
Lukas Wirth 2022-05-05 12:08:40 +02:00
parent 52a58f672e
commit 25d133e3b8
13 changed files with 97 additions and 68 deletions

View file

@ -270,13 +270,17 @@ impl<'a> CompletionContext<'a> {
|| matches!(self.name_ctx, Some(NameContext::RecordField))
}
pub(crate) fn has_impl_or_trait_prev_sibling(&self) -> bool {
/// Whether the cursor is right after a trait or impl header.
/// trait Foo ident$0
// FIXME: This probably shouldn't exist
pub(crate) fn has_unfinished_impl_or_trait_prev_sibling(&self) -> bool {
matches!(
self.prev_sibling,
Some(ImmediatePrevSibling::ImplDefType | ImmediatePrevSibling::TraitDefName)
)
}
// FIXME: This probably shouldn't exist
pub(crate) fn has_impl_prev_sibling(&self) -> bool {
matches!(self.prev_sibling, Some(ImmediatePrevSibling::ImplDefType))
}
@ -289,6 +293,7 @@ impl<'a> CompletionContext<'a> {
matches!(self.prev_sibling, Some(ImmediatePrevSibling::IfExpr))
}
// FIXME: This shouldn't exist
pub(crate) fn is_path_disallowed(&self) -> bool {
self.previous_token_is(T![unsafe])
|| matches!(