diff options
-rw-r--r-- | crates/ra_analysis/src/completion.rs | 12 | ||||
-rw-r--r-- | crates/ra_analysis/src/imp.rs | 3 |
2 files changed, 7 insertions, 8 deletions
diff --git a/crates/ra_analysis/src/completion.rs b/crates/ra_analysis/src/completion.rs index 074033ad8..09894d955 100644 --- a/crates/ra_analysis/src/completion.rs +++ b/crates/ra_analysis/src/completion.rs | |||
@@ -24,7 +24,7 @@ pub use crate::completion::completion_item::{CompletionItem, InsertText}; | |||
24 | pub(crate) fn completions( | 24 | pub(crate) fn completions( |
25 | db: &db::RootDatabase, | 25 | db: &db::RootDatabase, |
26 | position: FilePosition, | 26 | position: FilePosition, |
27 | ) -> Cancelable<Option<Vec<CompletionItem>>> { | 27 | ) -> Cancelable<Option<Completions>> { |
28 | let original_file = db.source_file(position.file_id); | 28 | let original_file = db.source_file(position.file_id); |
29 | // Insert a fake ident to get a valid parse tree | 29 | // Insert a fake ident to get a valid parse tree |
30 | let file = { | 30 | let file = { |
@@ -53,12 +53,10 @@ pub(crate) fn completions( | |||
53 | param_completions(&mut acc, name.syntax()); | 53 | param_completions(&mut acc, name.syntax()); |
54 | } | 54 | } |
55 | } | 55 | } |
56 | let res = if has_completions { | 56 | if !has_completions { |
57 | Some(acc.into()) | 57 | return Ok(None); |
58 | } else { | 58 | } |
59 | None | 59 | Ok(Some(acc)) |
60 | }; | ||
61 | Ok(res) | ||
62 | } | 60 | } |
63 | 61 | ||
64 | /// Complete repeated parametes, both name and type. For example, if all | 62 | /// Complete repeated parametes, both name and type. For example, if all |
diff --git a/crates/ra_analysis/src/imp.rs b/crates/ra_analysis/src/imp.rs index 5701e1ae2..340f7c78c 100644 --- a/crates/ra_analysis/src/imp.rs +++ b/crates/ra_analysis/src/imp.rs | |||
@@ -219,7 +219,8 @@ impl AnalysisImpl { | |||
219 | self.db.crate_graph().crate_root(crate_id) | 219 | self.db.crate_graph().crate_root(crate_id) |
220 | } | 220 | } |
221 | pub fn completions(&self, position: FilePosition) -> Cancelable<Option<Vec<CompletionItem>>> { | 221 | pub fn completions(&self, position: FilePosition) -> Cancelable<Option<Vec<CompletionItem>>> { |
222 | completions(&self.db, position) | 222 | let completions = completions(&self.db, position)?; |
223 | Ok(completions.map(|it| it.into())) | ||
223 | } | 224 | } |
224 | pub fn approximately_resolve_symbol( | 225 | pub fn approximately_resolve_symbol( |
225 | &self, | 226 | &self, |