Skip to content

Commit

Permalink
Add some notes about intrnal functions I should not be using
Browse files Browse the repository at this point in the history
  • Loading branch information
deathbeam committed Feb 26, 2024
1 parent a220a21 commit 03b8d4d
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lua/autocomplete/buffer.lua
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ local function complete_treesitter(bufnr, prefix, cmp_start)
local items = {}

for id, entry in pairs(defs) do
-- FIXME: This is not pretty, the format of the ID is not documented and might change, but its fastest way
local name = id:match('k_(.+)_%d+_%d+_%d+_%d+$')
local node = entry.node
local kind = entry.kind
Expand Down Expand Up @@ -123,6 +124,7 @@ local function complete_lsp(bufnr, prefix, cmp_start, client, char)
vim.lsp.util.make_position_params(vim.api.nvim_get_current_win(), client.offset_encoding)
params.context = context
return util.request(client, methods.textDocument_completion, params, function(result)
-- FIXME: Maybe dont use interal lsp functions? Idk why its not exposed and the parent method is marked as deprecated
local items = vim.lsp._completion._lsp_to_complete_items(result, '')
complete(prefix, cmp_start, items)
end, bufnr)
Expand Down

0 comments on commit 03b8d4d

Please sign in to comment.