Skip to content
This repository has been archived by the owner on Jul 21, 2024. It is now read-only.

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
glepnir committed Nov 29, 2023
1 parent 06ab4e5 commit 07a9463
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions lua/epo/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ local function complete_ondone(bufnr)
if not cp_item then
return
end
--usually the first is main client for me.
local client = lsp.get_clients({ id = context[args.buf].client_id })[1]
if not client then
return
Expand All @@ -197,16 +198,6 @@ local function complete_ondone(bufnr)
local lnum, col = unpack(api.nvim_win_get_cursor(0))
local curline = api.nvim_get_current_line()

local total = api.nvim_buf_line_count(bufnr)
if cp_item.additionalTextEdits then
lsp.util.apply_text_edits(cp_item.additionalTextEdits, bufnr, 'utf-8')
local increase = api.nvim_buf_line_count(bufnr) - total
if cp_item.textEdit then
cp_item.textEdit.range.start.line = cp_item.textEdit.range.start.line + increase
cp_item.textEdit.range['end'].line = cp_item.textEdit.range['end'].line + increase
end
end

local is_snippet = item.kind == 's'
or cp_item.insertTextFormat == protocol.InsertTextFormat.Snippet
local offset_snip
Expand Down Expand Up @@ -258,6 +249,10 @@ local function complete_ondone(bufnr)
end
end

if cp_item.additionalTextEdits then
lsp.util.apply_text_edits(cp_item.additionalTextEdits, bufnr, client.offset_encoding)
end

if signature then
local clients =
vim.lsp.get_clients({ bufnr = args.buf, method = ms.textDocument_signatureHelp })
Expand Down

0 comments on commit 07a9463

Please sign in to comment.