Skip to content
This repository was archived by the owner on Mar 13, 2025. It is now read-only.

Commit b573165

Browse files
committed
fix entry mapping
Signed-off-by: Tomas Slusny <[email protected]>
1 parent 44f53bd commit b573165

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

lua/autocomplete/buffer.lua

+12-12
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,6 @@ local function complete(prefix, cmp_start, items)
2323
items = vim.tbl_map(M.config.entry_mapper, items)
2424
end
2525

26-
table.sort(items, function(a, b)
27-
local _, entry1_under = a.word:find('^_+')
28-
local _, entry2_under = b.word:find('^_+')
29-
entry1_under = entry1_under or 0
30-
entry2_under = entry2_under or 0
31-
return entry1_under < entry2_under
32-
end)
33-
3426
vim.fn.complete(cmp_start + 1, items)
3527
end
3628

@@ -203,12 +195,20 @@ function M.setup(config)
203195
vim.lsp.completion.enable(true, client.id, event.buf, {
204196
autotrigger = false,
205197
convert = function(item)
198+
local entry = {
199+
abbr = item.label,
200+
kind = vim.lsp.protocol.CompletionItemKind[item.kind] or 'Unknown',
201+
menu = item.detail or '',
202+
icase = 1,
203+
dup = 0,
204+
empty = 0,
205+
}
206+
206207
if M.config.entry_mapper then
207-
---@diagnostic disable-next-line: assign-type-mismatch
208-
item.kind = vim.lsp.protocol.CompletionItemKind[item.kind] or ''
209-
return M.config.entry_mapper(item)
208+
return M.config.entry_mapper(entry)
210209
end
211-
return item
210+
211+
return entry
212212
end,
213213
})
214214
end,

0 commit comments

Comments
 (0)