diff options
author | Aleksey Kladov <[email protected]> | 2018-12-21 12:50:07 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2018-12-21 12:50:07 +0000 |
commit | d4ef07b2355df891d4f9b7641f0246ebe5bd6a6b (patch) | |
tree | 30d9d415773d4a68d93d8a2c194ade23a80a1aa9 /crates/ra_analysis/src/completion.rs | |
parent | ba0072401c3b8b6c9391428672bd91055150c8ee (diff) |
use completions in API
Diffstat (limited to 'crates/ra_analysis/src/completion.rs')
-rw-r--r-- | crates/ra_analysis/src/completion.rs | 12 |
1 files changed, 5 insertions, 7 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 |