Skip to content
This repository has been archived by the owner on Oct 13, 2021. It is now read-only.

Support completionItem/resolve for additional text edits #342

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion lua/completion.lua
Original file line number Diff line number Diff line change
Expand Up @@ -107,13 +107,22 @@ local function applyAddtionalTextEdits(completed_item)
}
})
else
if item.additionalTextEdits then
if next(item.additionalTextEdits or {}) then
local bufnr = api.nvim_get_current_buf()
local edits = vim.tbl_filter(
function(x) return x.range.start.line ~= (lnum - 1) end,
item.additionalTextEdits
)
vim.lsp.util.apply_text_edits(edits, bufnr)
else
vim.lsp.buf_request(bufnr, "completionItem/resolve", item, function(err, _, result)
if err or not result then
return
end
if result.additionalTextEdits then
vim.lsp.util.apply_text_edits(result.additionalTextEdits, bufnr)
end
end)
end
end
end
Expand Down