autoload/lsp/capabilities.vim | 3 ++- autoload/lsp/completion.vim | 10 ++++++++-- diff --git a/autoload/lsp/capabilities.vim b/autoload/lsp/capabilities.vim index d2719e049e6d03198525bd9b61d2eb231db347f4..f29f250f64f0c95d9c6af207d5fa70c61526335f 100644 --- a/autoload/lsp/capabilities.vim +++ b/autoload/lsp/capabilities.vim @@ -323,7 +323,8 @@ dynamicRegistration: false, completionItem: { documentationFormat: ['markdown', 'plaintext'], resolveSupport: {properties: ['detail', 'documentation']}, - snippetSupport: opt.lspOptions.snippetSupport + snippetSupport: opt.lspOptions.snippetSupport, + insertReplaceSupport: false }, completionItemKind: {valueSet: range(1, 25)} }, diff --git a/autoload/lsp/completion.vim b/autoload/lsp/completion.vim index 5e38296e1ea8585a487137038cf3545080512cd6..13614d305845f0b828d17b9f6c9a54c13456424f 100644 --- a/autoload/lsp/completion.vim +++ b/autoload/lsp/completion.vim @@ -191,7 +191,7 @@ for item in items var d: dict = {} # TODO: Add proper support for item.textEdit.newText and - # item.textEdit.range Keep in mind that item.textEdit.range can start be + # item.textEdit.range. Keep in mind that item.textEdit.range can start # way before the typed keyword. if item->has_key('textEdit') && lspOpts.completionMatcherValue != opt.COMPLETIONMATCHER_FUZZY @@ -202,8 +202,14 @@ else start_charcol = chcol endif var textEdit = item.textEdit + var textEditRange: dict = {} + if textEdit->has_key('range') + textEditRange = textEdit.range + elseif textEdit->has_key('insert') + textEditRange = textEdit.insert + endif var textEditStartCol = - util.GetCharIdxWithoutCompChar(bufnr(), textEdit.range.start) + util.GetCharIdxWithoutCompChar(bufnr(), textEditRange.start) if textEditStartCol != start_charcol var offset = start_charcol - textEditStartCol - 1 d.word = textEdit.newText[offset : ]