aboutsummaryrefslogtreecommitdiff
path: root/crates/completion
diff options
context:
space:
mode:
authorKirill Bulatov <[email protected]>2020-12-06 21:58:15 +0000
committerKirill Bulatov <[email protected]>2020-12-07 21:41:08 +0000
commit19cfa5802eabddd5747bbdb04c81b50fc9f6e623 (patch)
tree51ad6df2fdd89084f04b081d375cb29679eda9ef /crates/completion
parent6badf705b380bf8a66c5a1d8349365cab7a8ed4d (diff)
Simplify
Diffstat (limited to 'crates/completion')
-rw-r--r--crates/completion/src/lib.rs6
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)]