diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-05-03 05:56:59 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2020-05-03 05:56:59 +0100 |
commit | 2474f42ae95bffea7c0bc713f92322bfec4d59a7 (patch) | |
tree | aa7eb8f934a1ce4bcd32bd106fbbd2adafef023f /crates/ra_ide/src/completion.rs | |
parent | 17bd79f4978f1bf7267b54f86d676eed44af02d0 (diff) | |
parent | 2fd054f276e6fd75237b476622d03eef2f18430a (diff) |
Merge #4270
4270: Improve derive macro completion r=edwin0cheng a=SomeoneToIgnore
* Adds completions for standard derive macros (considering their dependencies on each other, so we don't get compile errors)
* Adds completions for custom derive macros that are in scope, if the proc macro feature is enabled in the settings
* Separates macro completion from other completions to avoid incorrect completion propositions
Co-authored-by: Kirill Bulatov <[email protected]>
Diffstat (limited to 'crates/ra_ide/src/completion.rs')
-rw-r--r-- | crates/ra_ide/src/completion.rs | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/crates/ra_ide/src/completion.rs b/crates/ra_ide/src/completion.rs index 4ca0fdf4f..a0e06faa2 100644 --- a/crates/ra_ide/src/completion.rs +++ b/crates/ra_ide/src/completion.rs | |||
@@ -65,21 +65,23 @@ pub(crate) fn completions( | |||
65 | let ctx = CompletionContext::new(db, position, config)?; | 65 | let ctx = CompletionContext::new(db, position, config)?; |
66 | 66 | ||
67 | let mut acc = Completions::default(); | 67 | let mut acc = Completions::default(); |
68 | 68 | if ctx.attribute_under_caret.is_some() { | |
69 | complete_fn_param::complete_fn_param(&mut acc, &ctx); | 69 | complete_attribute::complete_attribute(&mut acc, &ctx); |
70 | complete_keyword::complete_expr_keyword(&mut acc, &ctx); | 70 | } else { |
71 | complete_keyword::complete_use_tree_keyword(&mut acc, &ctx); | 71 | complete_fn_param::complete_fn_param(&mut acc, &ctx); |
72 | complete_snippet::complete_expr_snippet(&mut acc, &ctx); | 72 | complete_keyword::complete_expr_keyword(&mut acc, &ctx); |
73 | complete_snippet::complete_item_snippet(&mut acc, &ctx); | 73 | complete_keyword::complete_use_tree_keyword(&mut acc, &ctx); |
74 | complete_qualified_path::complete_qualified_path(&mut acc, &ctx); | 74 | complete_snippet::complete_expr_snippet(&mut acc, &ctx); |
75 | complete_unqualified_path::complete_unqualified_path(&mut acc, &ctx); | 75 | complete_snippet::complete_item_snippet(&mut acc, &ctx); |
76 | complete_dot::complete_dot(&mut acc, &ctx); | 76 | complete_qualified_path::complete_qualified_path(&mut acc, &ctx); |
77 | complete_record::complete_record(&mut acc, &ctx); | 77 | complete_unqualified_path::complete_unqualified_path(&mut acc, &ctx); |
78 | complete_pattern::complete_pattern(&mut acc, &ctx); | 78 | complete_dot::complete_dot(&mut acc, &ctx); |
79 | complete_postfix::complete_postfix(&mut acc, &ctx); | 79 | complete_record::complete_record(&mut acc, &ctx); |
80 | complete_macro_in_item_position::complete_macro_in_item_position(&mut acc, &ctx); | 80 | complete_pattern::complete_pattern(&mut acc, &ctx); |
81 | complete_trait_impl::complete_trait_impl(&mut acc, &ctx); | 81 | complete_postfix::complete_postfix(&mut acc, &ctx); |
82 | complete_attribute::complete_attribute(&mut acc, &ctx); | 82 | complete_macro_in_item_position::complete_macro_in_item_position(&mut acc, &ctx); |
83 | complete_trait_impl::complete_trait_impl(&mut acc, &ctx); | ||
84 | } | ||
83 | 85 | ||
84 | Some(acc) | 86 | Some(acc) |
85 | } | 87 | } |