diff options
author | Kirill Bulatov <[email protected]> | 2020-12-06 21:58:15 +0000 |
---|---|---|
committer | Kirill Bulatov <[email protected]> | 2020-12-07 21:41:08 +0000 |
commit | 19cfa5802eabddd5747bbdb04c81b50fc9f6e623 (patch) | |
tree | 51ad6df2fdd89084f04b081d375cb29679eda9ef /crates/completion | |
parent | 6badf705b380bf8a66c5a1d8349365cab7a8ed4d (diff) |
Simplify
Diffstat (limited to 'crates/completion')
-rw-r--r-- | crates/completion/src/lib.rs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/crates/completion/src/lib.rs b/crates/completion/src/lib.rs index 938c92dbb..066d589af 100644 --- a/crates/completion/src/lib.rs +++ b/crates/completion/src/lib.rs | |||
@@ -141,7 +141,7 @@ pub fn resolve_completion_edits( | |||
141 | position: FilePosition, | 141 | position: FilePosition, |
142 | full_import_path: &str, | 142 | full_import_path: &str, |
143 | imported_name: &str, | 143 | imported_name: &str, |
144 | ) -> Option<TextEdit> { | 144 | ) -> Option<Vec<TextEdit>> { |
145 | let ctx = CompletionContext::new(db, position, config)?; | 145 | let ctx = CompletionContext::new(db, position, config)?; |
146 | let anchor = ctx.name_ref_syntax.as_ref()?; | 146 | let anchor = ctx.name_ref_syntax.as_ref()?; |
147 | let import_scope = ImportScope::find_insert_use_container(anchor.syntax(), &ctx.sema)?; | 147 | let import_scope = ImportScope::find_insert_use_container(anchor.syntax(), &ctx.sema)?; |
@@ -156,7 +156,9 @@ pub fn resolve_completion_edits( | |||
156 | }) | 156 | }) |
157 | .find(|mod_path| mod_path.to_string() == full_import_path)?; | 157 | .find(|mod_path| mod_path.to_string() == full_import_path)?; |
158 | 158 | ||
159 | ImportEdit { import_path, import_scope, merge_behaviour: config.merge }.to_text_edit() | 159 | ImportEdit { import_path, import_scope, merge_behaviour: config.merge } |
160 | .to_text_edit() | ||
161 | .map(|edit| vec![edit]) | ||
160 | } | 162 | } |
161 | 163 | ||
162 | #[cfg(test)] | 164 | #[cfg(test)] |