Skip to content

Commit 5d97667

Browse files
bors[bot]jrvidal
andauthored
Merge #4105
4105: Adds attribute completions (#3941) r=matklad a=jrvidal I've hacked together some basic completions for a few builtin attributes. * I have no idea what `CompletionItemKind` we should set for them. * There's plenty of fancy stuff we could do by detecting the item the attribute is being added to. Nothing of that here. * Maybe we could complete as soon as you type `#` or `#!`? I'm not sure what info exactly we can dump on `CompletionContext` and what we should query during the completion calculation itself. I've assumed adding an `is_attribute` field is OK, since it allows to discard the completion quickly if it doesn't apply. Later we inspect the AST to find out whether it is an inner attribute or not. Co-authored-by: Roberto Vidal <[email protected]>
2 parents edd6f91 + 0dab5d5 commit 5d97667

File tree

5 files changed

+595
-0
lines changed

5 files changed

+595
-0
lines changed

crates/ra_ide/src/completion.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ mod completion_item;
55
mod completion_context;
66
mod presentation;
77

8+
mod complete_attribute;
89
mod complete_dot;
910
mod complete_record;
1011
mod complete_pattern;
@@ -78,6 +79,7 @@ pub(crate) fn completions(
7879
complete_postfix::complete_postfix(&mut acc, &ctx);
7980
complete_macro_in_item_position::complete_macro_in_item_position(&mut acc, &ctx);
8081
complete_trait_impl::complete_trait_impl(&mut acc, &ctx);
82+
complete_attribute::complete_attribute(&mut acc, &ctx);
8183

8284
Some(acc)
8385
}

0 commit comments

Comments
 (0)