Skip to content

Commit

Permalink
fix(entry/get_replace_range): handle TextEdit.range
Browse files Browse the repository at this point in the history
fixes cmp.mapping.confirm when ConfirmBehavior is set to Replace
  • Loading branch information
lvimuser committed Aug 20, 2022
1 parent b1ebdb0 commit 5d9ca01
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lua/cmp/entry.lua
Original file line number Diff line number Diff line change
Expand Up @@ -333,8 +333,12 @@ end
entry.get_replace_range = function(self)
return self.cache:ensure({ 'get_replace_range', self.resolved_completion_item and 1 or 0 }, function()
local replace_range
if misc.safe(self:get_completion_item().textEdit) and misc.safe(self:get_completion_item().textEdit.replace) then
replace_range = self:get_completion_item().textEdit.replace
if misc.safe(self:get_completion_item().textEdit) then
if misc.safe(self:get_completion_item().textEdit.replace) then
replace_range = self:get_completion_item().textEdit.replace
else
replace_range = self:get_completion_item().textEdit.range
end
else
replace_range = {
start = {
Expand Down

0 comments on commit 5d9ca01

Please sign in to comment.