1 //! Completes function abi strings.
8 completions::Completions, context::CompletionContext, CompletionItem, CompletionItemKind,
11 // Most of these are feature gated, we should filter/add feature gate completions once we have them.
12 const SUPPORTED_CALLING_CONVENTIONS: &[&str] = &[
32 "avr-non-blocking-interrupt",
33 "C-cmse-nonsecure-call",
43 pub(crate) fn complete_extern_abi(
44 acc: &mut Completions,
45 _ctx: &CompletionContext<'_>,
46 expanded: &ast::String,
48 if !expanded.syntax().parent().map_or(false, |it| ast::Abi::can_cast(it.kind())) {
51 let abi_str = expanded;
52 let source_range = abi_str.text_range_between_quotes()?;
53 for &abi in SUPPORTED_CALLING_CONVENTIONS {
54 CompletionItem::new(CompletionItemKind::Keyword, source_range, abi).add_to(acc);
61 use expect_test::{expect, Expect};
63 use crate::tests::{check_edit, completion_list_no_kw};
65 fn check(ra_fixture: &str, expect: Expect) {
66 let actual = completion_list_no_kw(ra_fixture);
67 expect.assert_eq(&actual);
71 fn only_completes_in_string_literals() {
81 fn requires_extern_prefix() {
101 extern "$0" fn foo {}
104 extern "Rust" fn foo {}