M lua/complementree/init.lua => lua/complementree/init.lua +0 -3
@@ 132,9 132,6 @@ function M.complete()
local cursor_pos = cursor[2]
local line_to_cursor, pref_start, _prefix = M.separate_prefix(line, cursor_pos)
-
-
-
local func = get_completion(ft, line_to_cursor, lnum, pref_start)
if not (func == nil) then
if func(line_to_cursor, lnum) then
M lua/complementree/sources.lua => lua/complementree/sources.lua +9 -2
@@ 38,7 38,14 @@ local function cached(kind, func)
end
end
-local apply_snippet = function(...)
+local apply_snippet = function(item, suffix, lnum)
+ if item.textEdit then
+ vim.snippet.expand(item.textEdit.newText .. suffix)
+ elseif item.insertText then
+ vim.snippet.expand(item.insertText .. suffix)
+ elseif item.label then
+ vim.snippet.expand(item.label .. suffix)
+ end
end
---@class LSPMatchesOpts
@@ 86,7 93,7 @@ function Sources.lsp_matches(opts)
local start_col = vim.fn.match(line_to_cursor, '\\k*$') + 1
for client_id, result in pairs(result_all) do
local client = lsp.get_client_by_id(client_id)
- local items = lsp.util.extract_completion_items(result.result) or {}
+ local items = result.result.items or {}
local tmp_col = adjust_start_col(lnum, line_to_cursor, items, client.offset_encoding or 'utf-16')
if tmp_col and tmp_col < start_col then