diff options
Diffstat (limited to 'crates/ide_completion/src/completions.rs')
-rw-r--r-- | crates/ide_completion/src/completions.rs | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/crates/ide_completion/src/completions.rs b/crates/ide_completion/src/completions.rs index 09882c4f3..cdac4e41a 100644 --- a/crates/ide_completion/src/completions.rs +++ b/crates/ide_completion/src/completions.rs | |||
@@ -2,25 +2,27 @@ | |||
2 | 2 | ||
3 | pub(crate) mod attribute; | 3 | pub(crate) mod attribute; |
4 | pub(crate) mod dot; | 4 | pub(crate) mod dot; |
5 | pub(crate) mod record; | 5 | pub(crate) mod flyimport; |
6 | pub(crate) mod pattern; | ||
7 | pub(crate) mod fn_param; | 6 | pub(crate) mod fn_param; |
8 | pub(crate) mod keyword; | 7 | pub(crate) mod keyword; |
9 | pub(crate) mod snippet; | 8 | pub(crate) mod lifetime; |
10 | pub(crate) mod qualified_path; | ||
11 | pub(crate) mod unqualified_path; | ||
12 | pub(crate) mod postfix; | ||
13 | pub(crate) mod macro_in_item_position; | 9 | pub(crate) mod macro_in_item_position; |
14 | pub(crate) mod trait_impl; | ||
15 | pub(crate) mod mod_; | 10 | pub(crate) mod mod_; |
16 | pub(crate) mod flyimport; | 11 | pub(crate) mod pattern; |
12 | pub(crate) mod postfix; | ||
13 | pub(crate) mod qualified_path; | ||
14 | pub(crate) mod record; | ||
15 | pub(crate) mod snippet; | ||
16 | pub(crate) mod trait_impl; | ||
17 | pub(crate) mod unqualified_path; | ||
17 | 18 | ||
18 | use std::iter; | 19 | use std::iter; |
19 | 20 | ||
20 | use hir::{known, ModPath, ScopeDef, Type}; | 21 | use hir::{known, ModPath, ScopeDef, Type}; |
22 | use ide_db::SymbolKind; | ||
21 | 23 | ||
22 | use crate::{ | 24 | use crate::{ |
23 | item::Builder, | 25 | item::{Builder, CompletionKind}, |
24 | render::{ | 26 | render::{ |
25 | const_::render_const, | 27 | const_::render_const, |
26 | enum_variant::render_variant, | 28 | enum_variant::render_variant, |
@@ -31,7 +33,7 @@ use crate::{ | |||
31 | type_alias::render_type_alias, | 33 | type_alias::render_type_alias, |
32 | RenderContext, | 34 | RenderContext, |
33 | }, | 35 | }, |
34 | CompletionContext, CompletionItem, | 36 | CompletionContext, CompletionItem, CompletionItemKind, |
35 | }; | 37 | }; |
36 | 38 | ||
37 | /// Represents an in-progress set of completions being built. | 39 | /// Represents an in-progress set of completions being built. |
@@ -77,6 +79,13 @@ impl Completions { | |||
77 | self.add(item); | 79 | self.add(item); |
78 | } | 80 | } |
79 | 81 | ||
82 | pub(crate) fn add_static_lifetime(&mut self, ctx: &CompletionContext) { | ||
83 | let mut item = | ||
84 | CompletionItem::new(CompletionKind::Reference, ctx.source_range(), "'static"); | ||
85 | item.kind(CompletionItemKind::SymbolKind(SymbolKind::LifetimeParam)); | ||
86 | self.add(item.build()); | ||
87 | } | ||
88 | |||
80 | pub(crate) fn add_resolution( | 89 | pub(crate) fn add_resolution( |
81 | &mut self, | 90 | &mut self, |
82 | ctx: &CompletionContext, | 91 | ctx: &CompletionContext, |