M lua/complementree/init.lua => lua/complementree/init.lua +2 -0
@@ 141,8 141,10 @@ function M._CompleteDone()
if not completed_item or not completed_item.user_data or not completed_item.user_data.source then
return
end
+ vim.notify("CompleteDone")
local func = sources.complete_done_cbs[completed_item.user_data.source]
if func then
+ vim.notify("CompleteDone found")
M lua/complementree/sources.lua => lua/complementree/sources.lua +7 -4
@@ 428,20 428,23 @@ local function lsp_completedone(completed_item)
local cursor = api.nvim_win_get_cursor(0)
local col = cursor[2]
local lnum = cursor[1] - 1
- local item = completed_item.user_data
local bufnr = api.nvim_get_current_buf()
- local expand_snippet = item.insertTextFormat == 2
- local client = lsp.get_client_by_id()
+ local extra = completed_item.user_data.extra
+ local item = extra.item
+
+ local client = lsp.get_client_by_id(extra.client_id)
if not client then
- return
+ error(string.format("Could not find client %d", extra.client_id))
end
+ local expand_snippet = item.insertTextFormat == 2
local resolveEdits = (client.server_capabilities.completionProvider or {}).resolveProvider
local offset_encoding = client and client.offset_encoding or 'utf-16'
local tidy = function() end
local suffix = nil
+
if expand_snippet then
local line = api.nvim_buf_get_lines(bufnr, lnum, lnum + 1, true)[1]
tidy = function()
M teal/complementree/init.tl => teal/complementree/init.tl +2 -0
@@ 141,8 141,10 @@ function M._CompleteDone()
if not completed_item or not completed_item.user_data or not completed_item.user_data.source then
return
end
+ vim.notify "CompleteDone"
local func = sources.complete_done_cbs[completed_item.user_data.source]
if func then
+ vim.notify "CompleteDone found"
-- We will force the ignore of InsertLeave events for a certain time, in order to avoid strange
-- behavior and flickering of the UI. So we _synchronously_ set 'eventignore' to ignore
-- InsertLeave, and schedule the reset in the loop.
M teal/complementree/sources.tl => teal/complementree/sources.tl +7 -4
@@ 428,20 428,23 @@ local function lsp_completedone(completed_item: CompleteItem)
local cursor = api.nvim_win_get_cursor(0)
local col = cursor[2]
local lnum = cursor[1] - 1
- local item = completed_item.user_data as lsp.LspCompletionItem
local bufnr = api.nvim_get_current_buf()
- local expand_snippet = item.insertTextFormat == 2
- local client = lsp.get_client_by_id()
+ local extra = completed_item.user_data.extra as LspExtraInfo
+ local item = extra.item
+
+ local client = lsp.get_client_by_id(extra.client_id)
if not client then
- return
+ error(string.format("Could not find client %d", extra.client_id))
end
+ local expand_snippet = item.insertTextFormat == 2
local resolveEdits = (client.server_capabilities.completionProvider or {}).resolveProvider
local offset_encoding = client and client.offset_encoding or 'utf-16'
local tidy = function() end
local suffix: string = nil
+
if expand_snippet then
local line = api.nvim_buf_get_lines(bufnr, lnum, lnum + 1, true)[1]
tidy = function()
M types/types.d.tl => types/types.d.tl +3 -0
@@ 150,6 150,9 @@ global record vim
tbl_map: function<T>(function(T), {T})
list_extend: function<T>({T}, {T}, integer|nil, integer|nil): {T}
+
+ notify: function(string)
+ pretty_print: function(...: any)
inspect: function(...: any): string
end