Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/ide-completion/src/completions/attribute.rs')
-rw-r--r--crates/ide-completion/src/completions/attribute.rs11
1 files changed, 7 insertions, 4 deletions
diff --git a/crates/ide-completion/src/completions/attribute.rs b/crates/ide-completion/src/completions/attribute.rs
index fef177d2dd..0b7479fd0e 100644
--- a/crates/ide-completion/src/completions/attribute.rs
+++ b/crates/ide-completion/src/completions/attribute.rs
@@ -18,7 +18,7 @@ use syntax::{
use crate::{
completions::module_or_attr,
- context::{CompletionContext, PathCompletionCtx, PathKind, PathQualifierCtx},
+ context::{CompletionContext, IdentContext, PathCompletionCtx, PathKind, PathQualifierCtx},
item::CompletionItem,
Completions,
};
@@ -35,7 +35,10 @@ pub(crate) fn complete_known_attribute_input(
acc: &mut Completions,
ctx: &CompletionContext,
) -> Option<()> {
- let attribute = ctx.fake_attribute_under_caret.as_ref()?;
+ let attribute = match &ctx.ident_ctx {
+ IdentContext::UnexpandedAttrTT { fake_attribute_under_caret: Some(it) } => it,
+ _ => return None,
+ };
let name_ref = match attribute.path() {
Some(p) => Some(p.as_single_name_ref()?),
None => None,
@@ -69,8 +72,8 @@ pub(crate) fn complete_known_attribute_input(
}
pub(crate) fn complete_attribute(acc: &mut Completions, ctx: &CompletionContext) {
- let (is_absolute_path, qualifier, is_inner, annotated_item_kind) = match ctx.path_context {
- Some(PathCompletionCtx {
+ let (is_absolute_path, qualifier, is_inner, annotated_item_kind) = match ctx.path_context() {
+ Some(&PathCompletionCtx {
kind: PathKind::Attr { kind, annotated_item_kind },
is_absolute_path,
ref qualifier,