This commit is contained in:
Kirill Bulatov 2020-12-06 23:58:15 +02:00
parent 6badf705b3
commit 19cfa5802e
4 changed files with 34 additions and 35 deletions

View file

@ -141,7 +141,7 @@ pub fn resolve_completion_edits(
position: FilePosition,
full_import_path: &str,
imported_name: &str,
) -> Option<TextEdit> {
) -> Option<Vec<TextEdit>> {
let ctx = CompletionContext::new(db, position, config)?;
let anchor = ctx.name_ref_syntax.as_ref()?;
let import_scope = ImportScope::find_insert_use_container(anchor.syntax(), &ctx.sema)?;
@ -156,7 +156,9 @@ pub fn resolve_completion_edits(
})
.find(|mod_path| mod_path.to_string() == full_import_path)?;
ImportEdit { import_path, import_scope, merge_behaviour: config.merge }.to_text_edit()
ImportEdit { import_path, import_scope, merge_behaviour: config.merge }
.to_text_edit()
.map(|edit| vec![edit])
}
#[cfg(test)]