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 | ||||
-rw-r--r-- | crates/completion/src/completions/unqualified_path.rs | 38 |
5 files changed, 34 insertions, 34 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 | } |
diff --git a/crates/completion/src/completions/unqualified_path.rs b/crates/completion/src/completions/unqualified_path.rs index 809e1645a..a289efc34 100644 --- a/crates/completion/src/completions/unqualified_path.rs +++ b/crates/completion/src/completions/unqualified_path.rs | |||
@@ -165,8 +165,8 @@ fn quux(x: i32) { | |||
165 | } | 165 | } |
166 | "#, | 166 | "#, |
167 | expect![[r#" | 167 | expect![[r#" |
168 | bn y i32 | 168 | lc y i32 |
169 | bn x i32 | 169 | lc x i32 |
170 | fn quux(…) fn quux(x: i32) | 170 | fn quux(…) fn quux(x: i32) |
171 | "#]], | 171 | "#]], |
172 | ); | 172 | ); |
@@ -187,8 +187,8 @@ fn quux() { | |||
187 | } | 187 | } |
188 | "#, | 188 | "#, |
189 | expect![[r#" | 189 | expect![[r#" |
190 | bn b i32 | 190 | lc b i32 |
191 | bn a | 191 | lc a |
192 | fn quux() fn quux() | 192 | fn quux() fn quux() |
193 | "#]], | 193 | "#]], |
194 | ); | 194 | ); |
@@ -203,7 +203,7 @@ fn quux() { | |||
203 | } | 203 | } |
204 | "#, | 204 | "#, |
205 | expect![[r#" | 205 | expect![[r#" |
206 | bn x | 206 | lc x |
207 | fn quux() fn quux() | 207 | fn quux() fn quux() |
208 | "#]], | 208 | "#]], |
209 | ); | 209 | ); |
@@ -241,7 +241,7 @@ fn main() { | |||
241 | check( | 241 | check( |
242 | r#"fn quux<const C: usize>() { $0 }"#, | 242 | r#"fn quux<const C: usize>() { $0 }"#, |
243 | expect![[r#" | 243 | expect![[r#" |
244 | tp C | 244 | cp C |
245 | fn quux() fn quux<const C: usize>() | 245 | fn quux() fn quux<const C: usize>() |
246 | "#]], | 246 | "#]], |
247 | ); | 247 | ); |
@@ -263,7 +263,7 @@ fn main() { | |||
263 | check( | 263 | check( |
264 | r#"struct S<T> { x: $0}"#, | 264 | r#"struct S<T> { x: $0}"#, |
265 | expect![[r#" | 265 | expect![[r#" |
266 | tp Self | 266 | sp Self |
267 | tp T | 267 | tp T |
268 | st S<…> | 268 | st S<…> |
269 | "#]], | 269 | "#]], |
@@ -275,7 +275,7 @@ fn main() { | |||
275 | check( | 275 | check( |
276 | r#"enum X { Y($0) }"#, | 276 | r#"enum X { Y($0) }"#, |
277 | expect![[r#" | 277 | expect![[r#" |
278 | tp Self | 278 | sp Self |
279 | en X | 279 | en X |
280 | "#]], | 280 | "#]], |
281 | ); | 281 | ); |
@@ -378,8 +378,8 @@ fn foo() { | |||
378 | "#, | 378 | "#, |
379 | // FIXME: should be only one bar here | 379 | // FIXME: should be only one bar here |
380 | expect![[r#" | 380 | expect![[r#" |
381 | bn bar i32 | 381 | lc bar i32 |
382 | bn bar i32 | 382 | lc bar i32 |
383 | fn foo() fn foo() | 383 | fn foo() fn foo() |
384 | "#]], | 384 | "#]], |
385 | ); | 385 | ); |
@@ -390,8 +390,8 @@ fn foo() { | |||
390 | check( | 390 | check( |
391 | r#"impl S { fn foo(&self) { $0 } }"#, | 391 | r#"impl S { fn foo(&self) { $0 } }"#, |
392 | expect![[r#" | 392 | expect![[r#" |
393 | bn self &{unknown} | 393 | lc self &{unknown} |
394 | tp Self | 394 | sp Self |
395 | "#]], | 395 | "#]], |
396 | ); | 396 | ); |
397 | } | 397 | } |
@@ -575,8 +575,8 @@ fn quux(x: i32) { | |||
575 | } | 575 | } |
576 | "#, | 576 | "#, |
577 | expect![[r#" | 577 | expect![[r#" |
578 | bn y i32 | 578 | lc y i32 |
579 | bn x i32 | 579 | lc x i32 |
580 | fn quux(…) fn quux(x: i32) | 580 | fn quux(…) fn quux(x: i32) |
581 | ma m!(…) macro_rules! m | 581 | ma m!(…) macro_rules! m |
582 | "#]], | 582 | "#]], |
@@ -594,8 +594,8 @@ fn quux(x: i32) { | |||
594 | } | 594 | } |
595 | ", | 595 | ", |
596 | expect![[r#" | 596 | expect![[r#" |
597 | bn y i32 | 597 | lc y i32 |
598 | bn x i32 | 598 | lc x i32 |
599 | fn quux(…) fn quux(x: i32) | 599 | fn quux(…) fn quux(x: i32) |
600 | ma m!(…) macro_rules! m | 600 | ma m!(…) macro_rules! m |
601 | "#]], | 601 | "#]], |
@@ -613,8 +613,8 @@ fn quux(x: i32) { | |||
613 | } | 613 | } |
614 | "#, | 614 | "#, |
615 | expect![[r#" | 615 | expect![[r#" |
616 | bn y i32 | 616 | lc y i32 |
617 | bn x i32 | 617 | lc x i32 |
618 | fn quux(…) fn quux(x: i32) | 618 | fn quux(…) fn quux(x: i32) |
619 | ma m!(…) macro_rules! m | 619 | ma m!(…) macro_rules! m |
620 | "#]], | 620 | "#]], |
@@ -750,7 +750,7 @@ struct MyStruct {} | |||
750 | impl My$0 | 750 | impl My$0 |
751 | "#, | 751 | "#, |
752 | expect![[r#" | 752 | expect![[r#" |
753 | tp Self | 753 | sp Self |
754 | tt MyTrait | 754 | tt MyTrait |
755 | st MyStruct | 755 | st MyStruct |
756 | "#]], | 756 | "#]], |