diff options
Diffstat (limited to 'crates/completion/src/completions')
-rw-r--r-- | crates/completion/src/completions/fn_param.rs | 4 | ||||
-rw-r--r-- | crates/completion/src/completions/mod_.rs | 10 | ||||
-rw-r--r-- | crates/completion/src/completions/record.rs | 8 | ||||
-rw-r--r-- | crates/completion/src/completions/trait_impl.rs | 8 |
4 files changed, 15 insertions, 15 deletions
diff --git a/crates/completion/src/completions/fn_param.rs b/crates/completion/src/completions/fn_param.rs index 5505c3559..38e33a93e 100644 --- a/crates/completion/src/completions/fn_param.rs +++ b/crates/completion/src/completions/fn_param.rs | |||
@@ -6,7 +6,7 @@ use syntax::{ | |||
6 | match_ast, AstNode, | 6 | match_ast, AstNode, |
7 | }; | 7 | }; |
8 | 8 | ||
9 | use crate::{CompletionContext, CompletionItem, CompletionKind, Completions}; | 9 | use crate::{CompletionContext, CompletionItem, CompletionItemKind, CompletionKind, Completions}; |
10 | 10 | ||
11 | /// Complete repeated parameters, both name and type. For example, if all | 11 | /// Complete repeated parameters, both name and type. For example, if all |
12 | /// functions in a file have a `spam: &mut Spam` parameter, a completion with | 12 | /// functions in a file have a `spam: &mut Spam` parameter, a completion with |
@@ -58,7 +58,7 @@ pub(crate) fn complete_fn_param(acc: &mut Completions, ctx: &CompletionContext) | |||
58 | }) | 58 | }) |
59 | .for_each(|(label, lookup)| { | 59 | .for_each(|(label, lookup)| { |
60 | CompletionItem::new(CompletionKind::Magic, ctx.source_range(), label) | 60 | CompletionItem::new(CompletionKind::Magic, ctx.source_range(), label) |
61 | .kind(crate::CompletionItemKind::Binding) | 61 | .kind(CompletionItemKind::Binding) |
62 | .lookup_by(lookup) | 62 | .lookup_by(lookup) |
63 | .add_to(acc) | 63 | .add_to(acc) |
64 | }); | 64 | }); |
diff --git a/crates/completion/src/completions/mod_.rs b/crates/completion/src/completions/mod_.rs index 00e951ca9..352fc7c77 100644 --- a/crates/completion/src/completions/mod_.rs +++ b/crates/completion/src/completions/mod_.rs | |||
@@ -3,11 +3,13 @@ | |||
3 | use std::iter; | 3 | use std::iter; |
4 | 4 | ||
5 | use hir::{Module, ModuleSource}; | 5 | use hir::{Module, ModuleSource}; |
6 | use ide_db::base_db::{SourceDatabaseExt, VfsPath}; | 6 | use ide_db::{ |
7 | use ide_db::RootDatabase; | 7 | base_db::{SourceDatabaseExt, VfsPath}, |
8 | RootDatabase, SymbolKind, | ||
9 | }; | ||
8 | use rustc_hash::FxHashSet; | 10 | use rustc_hash::FxHashSet; |
9 | 11 | ||
10 | use crate::{CompletionItem, CompletionItemKind}; | 12 | use crate::CompletionItem; |
11 | 13 | ||
12 | use crate::{context::CompletionContext, item::CompletionKind, Completions}; | 14 | use crate::{context::CompletionContext, item::CompletionKind, Completions}; |
13 | 15 | ||
@@ -79,7 +81,7 @@ pub(crate) fn complete_mod(acc: &mut Completions, ctx: &CompletionContext) -> Op | |||
79 | label.push(';'); | 81 | label.push(';'); |
80 | } | 82 | } |
81 | CompletionItem::new(CompletionKind::Magic, ctx.source_range(), &label) | 83 | CompletionItem::new(CompletionKind::Magic, ctx.source_range(), &label) |
82 | .kind(CompletionItemKind::Module) | 84 | .kind(SymbolKind::Module) |
83 | .add_to(acc) | 85 | .add_to(acc) |
84 | }); | 86 | }); |
85 | 87 | ||
diff --git a/crates/completion/src/completions/record.rs b/crates/completion/src/completions/record.rs index bb6354ded..0a7927eb8 100644 --- a/crates/completion/src/completions/record.rs +++ b/crates/completion/src/completions/record.rs | |||
@@ -1,10 +1,8 @@ | |||
1 | //! Complete fields in record literals and patterns. | 1 | //! Complete fields in record literals and patterns. |
2 | use ide_db::helpers::FamousDefs; | 2 | use ide_db::{helpers::FamousDefs, SymbolKind}; |
3 | use syntax::ast::Expr; | 3 | use syntax::ast::Expr; |
4 | 4 | ||
5 | use crate::{ | 5 | use crate::{item::CompletionKind, CompletionContext, CompletionItem, Completions}; |
6 | item::CompletionKind, CompletionContext, CompletionItem, CompletionItemKind, Completions, | ||
7 | }; | ||
8 | 6 | ||
9 | pub(crate) fn complete_record(acc: &mut Completions, ctx: &CompletionContext) -> Option<()> { | 7 | pub(crate) fn complete_record(acc: &mut Completions, ctx: &CompletionContext) -> Option<()> { |
10 | let missing_fields = match (ctx.record_pat_syntax.as_ref(), ctx.record_lit_syntax.as_ref()) { | 8 | let missing_fields = match (ctx.record_pat_syntax.as_ref(), ctx.record_lit_syntax.as_ref()) { |
@@ -31,7 +29,7 @@ pub(crate) fn complete_record(acc: &mut Completions, ctx: &CompletionContext) -> | |||
31 | "..Default::default()", | 29 | "..Default::default()", |
32 | ) | 30 | ) |
33 | .insert_text(completion_text) | 31 | .insert_text(completion_text) |
34 | .kind(CompletionItemKind::Field) | 32 | .kind(SymbolKind::Field) |
35 | .build(), | 33 | .build(), |
36 | ); | 34 | ); |
37 | } | 35 | } |
diff --git a/crates/completion/src/completions/trait_impl.rs b/crates/completion/src/completions/trait_impl.rs index 135ae49dc..f258ad9c3 100644 --- a/crates/completion/src/completions/trait_impl.rs +++ b/crates/completion/src/completions/trait_impl.rs | |||
@@ -32,7 +32,7 @@ | |||
32 | //! ``` | 32 | //! ``` |
33 | 33 | ||
34 | use hir::{self, HasAttrs, HasSource}; | 34 | use hir::{self, HasAttrs, HasSource}; |
35 | use ide_db::traits::get_missing_assoc_items; | 35 | use ide_db::{traits::get_missing_assoc_items, SymbolKind}; |
36 | use syntax::{ | 36 | use syntax::{ |
37 | ast::{self, edit, Impl}, | 37 | ast::{self, edit, Impl}, |
38 | display::function_declaration, | 38 | display::function_declaration, |
@@ -152,7 +152,7 @@ fn add_function_impl( | |||
152 | let completion_kind = if func.self_param(ctx.db).is_some() { | 152 | let completion_kind = if func.self_param(ctx.db).is_some() { |
153 | CompletionItemKind::Method | 153 | CompletionItemKind::Method |
154 | } else { | 154 | } else { |
155 | CompletionItemKind::Function | 155 | CompletionItemKind::SymbolKind(SymbolKind::Function) |
156 | }; | 156 | }; |
157 | let range = TextRange::new(fn_def_node.text_range().start(), ctx.source_range().end()); | 157 | let range = TextRange::new(fn_def_node.text_range().start(), ctx.source_range().end()); |
158 | 158 | ||
@@ -188,7 +188,7 @@ fn add_type_alias_impl( | |||
188 | CompletionItem::new(CompletionKind::Magic, ctx.source_range(), snippet.clone()) | 188 | CompletionItem::new(CompletionKind::Magic, ctx.source_range(), snippet.clone()) |
189 | .text_edit(TextEdit::replace(range, snippet)) | 189 | .text_edit(TextEdit::replace(range, snippet)) |
190 | .lookup_by(alias_name) | 190 | .lookup_by(alias_name) |
191 | .kind(CompletionItemKind::TypeAlias) | 191 | .kind(SymbolKind::TypeAlias) |
192 | .set_documentation(type_alias.docs(ctx.db)) | 192 | .set_documentation(type_alias.docs(ctx.db)) |
193 | .add_to(acc); | 193 | .add_to(acc); |
194 | } | 194 | } |
@@ -211,7 +211,7 @@ fn add_const_impl( | |||
211 | CompletionItem::new(CompletionKind::Magic, ctx.source_range(), snippet.clone()) | 211 | CompletionItem::new(CompletionKind::Magic, ctx.source_range(), snippet.clone()) |
212 | .text_edit(TextEdit::replace(range, snippet)) | 212 | .text_edit(TextEdit::replace(range, snippet)) |
213 | .lookup_by(const_name) | 213 | .lookup_by(const_name) |
214 | .kind(CompletionItemKind::Const) | 214 | .kind(SymbolKind::Const) |
215 | .set_documentation(const_.docs(ctx.db)) | 215 | .set_documentation(const_.docs(ctx.db)) |
216 | .add_to(acc); | 216 | .add_to(acc); |
217 | } | 217 | } |