Respect lsp completions' 'insert_text' property when present

Fixes #839
This commit is contained in:
Max Brunsfeld 2022-04-22 14:33:13 -07:00
parent c61ae6f31f
commit 8ddc7e6458

View file

@ -2502,13 +2502,12 @@ impl Project {
log::info!("completion out of expected range");
return None;
}
(
this.common_prefix_at(
clipped_position,
&lsp_completion.label,
),
lsp_completion.label.clone(),
)
let text = lsp_completion
.insert_text
.as_ref()
.unwrap_or(&lsp_completion.label)
.clone();
(this.common_prefix_at(clipped_position, &text), text.clone())
}
Some(lsp::CompletionTextEdit::InsertAndReplace(_)) => {
log::info!("unsupported insert/replace completion");