Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/ide-completion/src/completions/extern_abi.rs')
| -rw-r--r-- | crates/ide-completion/src/completions/extern_abi.rs | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/crates/ide-completion/src/completions/extern_abi.rs b/crates/ide-completion/src/completions/extern_abi.rs index ae8c199f0c..3007b3c319 100644 --- a/crates/ide-completion/src/completions/extern_abi.rs +++ b/crates/ide-completion/src/completions/extern_abi.rs @@ -5,9 +5,7 @@ use syntax::{ }; use crate::{ - completions::Completions, - context::{CompletionContext, IdentContext}, - CompletionItem, CompletionItemKind, + completions::Completions, context::CompletionContext, CompletionItem, CompletionItemKind, }; // Most of these are feature gated, we should filter/add feature gate completions once we have them. @@ -42,15 +40,15 @@ const SUPPORTED_CALLING_CONVENTIONS: &[&str] = &[ "unadjusted", ]; -pub(crate) fn complete_extern_abi(acc: &mut Completions, ctx: &CompletionContext) -> Option<()> { - let abi_str = match &ctx.ident_ctx { - IdentContext::String { expanded: Some(expanded), .. } - if expanded.syntax().parent().map_or(false, |it| ast::Abi::can_cast(it.kind())) => - { - expanded - } - _ => return None, - }; +pub(crate) fn complete_extern_abi( + acc: &mut Completions, + _ctx: &CompletionContext, + expanded: &ast::String, +) -> Option<()> { + if !expanded.syntax().parent().map_or(false, |it| ast::Abi::can_cast(it.kind())) { + return None; + } + let abi_str = expanded; let source_range = abi_str.text_range_between_quotes()?; for &abi in SUPPORTED_CALLING_CONVENTIONS { CompletionItem::new(CompletionItemKind::Keyword, source_range, abi).add_to(acc); |