diff options
Diffstat (limited to 'crates')
-rw-r--r-- | crates/ra_analysis/src/completion/complete_path.rs | 2 | ||||
-rw-r--r-- | crates/ra_analysis/src/completion/complete_scope.rs | 2 | ||||
-rw-r--r-- | crates/ra_analysis/src/completion/completion_item.rs | 12 |
3 files changed, 8 insertions, 8 deletions
diff --git a/crates/ra_analysis/src/completion/complete_path.rs b/crates/ra_analysis/src/completion/complete_path.rs index c73a083a4..99fe9aa94 100644 --- a/crates/ra_analysis/src/completion/complete_path.rs +++ b/crates/ra_analysis/src/completion/complete_path.rs | |||
@@ -17,7 +17,7 @@ pub(super) fn complete_path(acc: &mut Completions, ctx: &CompletionContext) -> C | |||
17 | let module_scope = module.scope(ctx.db)?; | 17 | let module_scope = module.scope(ctx.db)?; |
18 | module_scope.entries().for_each(|(name, res)| { | 18 | module_scope.entries().for_each(|(name, res)| { |
19 | CompletionItem::new(CompletionKind::Reference, name.to_string()) | 19 | CompletionItem::new(CompletionKind::Reference, name.to_string()) |
20 | .from_resolution(ctx.db, res) | 20 | .from_resolution(ctx, res) |
21 | .add_to(acc) | 21 | .add_to(acc) |
22 | }); | 22 | }); |
23 | } | 23 | } |
diff --git a/crates/ra_analysis/src/completion/complete_scope.rs b/crates/ra_analysis/src/completion/complete_scope.rs index cd98efe95..daf666505 100644 --- a/crates/ra_analysis/src/completion/complete_scope.rs +++ b/crates/ra_analysis/src/completion/complete_scope.rs | |||
@@ -34,7 +34,7 @@ pub(super) fn complete_scope(acc: &mut Completions, ctx: &CompletionContext) -> | |||
34 | }) | 34 | }) |
35 | .for_each(|(name, res)| { | 35 | .for_each(|(name, res)| { |
36 | CompletionItem::new(CompletionKind::Reference, name.to_string()) | 36 | CompletionItem::new(CompletionKind::Reference, name.to_string()) |
37 | .from_resolution(ctx.db, res) | 37 | .from_resolution(ctx, res) |
38 | .add_to(acc) | 38 | .add_to(acc) |
39 | }); | 39 | }); |
40 | Ok(()) | 40 | Ok(()) |
diff --git a/crates/ra_analysis/src/completion/completion_item.rs b/crates/ra_analysis/src/completion/completion_item.rs index b8fa39ae3..a3d947e5b 100644 --- a/crates/ra_analysis/src/completion/completion_item.rs +++ b/crates/ra_analysis/src/completion/completion_item.rs | |||
@@ -1,7 +1,7 @@ | |||
1 | use crate::db; | ||
2 | |||
3 | use hir::PerNs; | 1 | use hir::PerNs; |
4 | 2 | ||
3 | use crate::completion::CompletionContext; | ||
4 | |||
5 | /// `CompletionItem` describes a single completion variant in the editor pop-up. | 5 | /// `CompletionItem` describes a single completion variant in the editor pop-up. |
6 | /// It is basically a POD with various properties. To construct a | 6 | /// It is basically a POD with various properties. To construct a |
7 | /// `CompletionItem`, use `new` method and the `Builder` struct. | 7 | /// `CompletionItem`, use `new` method and the `Builder` struct. |
@@ -118,12 +118,12 @@ impl Builder { | |||
118 | self.kind = Some(kind); | 118 | self.kind = Some(kind); |
119 | self | 119 | self |
120 | } | 120 | } |
121 | pub(crate) fn from_resolution( | 121 | pub(super) fn from_resolution( |
122 | mut self, | 122 | mut self, |
123 | db: &db::RootDatabase, | 123 | ctx: &CompletionContext, |
124 | resolution: &hir::Resolution, | 124 | resolution: &hir::Resolution, |
125 | ) -> Builder { | 125 | ) -> Builder { |
126 | let resolved = resolution.def_id.and_then(|d| d.resolve(db).ok()); | 126 | let resolved = resolution.def_id.and_then(|d| d.resolve(ctx.db).ok()); |
127 | let kind = match resolved { | 127 | let kind = match resolved { |
128 | PerNs { | 128 | PerNs { |
129 | types: Some(hir::Def::Module(..)), | 129 | types: Some(hir::Def::Module(..)), |
@@ -141,7 +141,7 @@ impl Builder { | |||
141 | values: Some(hir::Def::Function(function)), | 141 | values: Some(hir::Def::Function(function)), |
142 | .. | 142 | .. |
143 | } => { | 143 | } => { |
144 | if let Some(sig_info) = function.signature_info(db) { | 144 | if let Some(sig_info) = function.signature_info(ctx.db) { |
145 | if sig_info.params.is_empty() { | 145 | if sig_info.params.is_empty() { |
146 | self.snippet = Some(format!("{}()$0", self.label)); | 146 | self.snippet = Some(format!("{}()$0", self.label)); |
147 | } else { | 147 | } else { |