lsp: Support insertReplace

Fixes #4473
This commit is contained in:
Blaž Hrastnik 2022-11-08 20:48:06 +09:00
parent 188aff059b
commit 13126823f8
No known key found for this signature in database
GPG key ID: 1238B9C4AD889640
2 changed files with 3 additions and 1 deletions

View file

@ -311,6 +311,7 @@ impl Client {
String::from("additionalTextEdits"),
],
}),
insert_replace_support: Some(true),
..Default::default()
}),
completion_item_kind: Some(lsp::CompletionItemKindCapability {

View file

@ -113,7 +113,8 @@ impl Completion {
let edit = match edit {
lsp::CompletionTextEdit::Edit(edit) => edit.clone(),
lsp::CompletionTextEdit::InsertAndReplace(item) => {
unimplemented!("completion: insert_and_replace {:?}", item)
// TODO: support using "insert" instead of "replace" via user config
lsp::TextEdit::new(item.replace, item.new_text.clone())
}
};