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 Dec 26, 2023
1 parent daeaf05 commit 1d8e7aa
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions lua/epo/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,15 @@ local function show_info(bufnr, curitem, selected)
local param = vim.tbl_get(curitem, 'user_data', 'nvim', 'lsp', 'completion_item')
local client = lsp.get_clients({ id = context[bufnr].client_id })[1]
client.request(ms.completionItem_resolve, param, function(_, result)
if not result then
local data = vim.fn.complete_info()
if
not result
or not data.items
or (data.items[data.selected + 1] and data.items[data.selected + 1].word ~= curitem.word)
then
if data.preview_winid and api.nvim_win_is_valid(data.preview_winid) then
api.nvim_win_close(data.preview_winid, true)
end
return
end
local value = vim.tbl_get(result, 'documentation', 'value')
Expand Down Expand Up @@ -433,9 +441,6 @@ local function completion_handler(_, result, ctx)
if mode == 'i' or mode == 'ic' then
vfn.complete(startcol, entrys)
complete_ondone(ctx.bufnr)
if vim.tbl_contains(vim.opt.completeopt:get(), 'popup') then
complete_changed(ctx.bufnr)
end
end
end

Expand Down Expand Up @@ -533,7 +538,7 @@ local function setup(opt)
return k:lower():sub(1, 1)
end
--make sure your neovim is newer enough
api.nvim_set_option_value('completeopt', 'menu,menuone,noinsert,', { scope = 'global' })
api.nvim_set_option_value('completeopt', 'menu,menuone,noinsert', { scope = 'global' })

-- Usually I just use one client for completion so just one
au('LspAttach', {
Expand All @@ -560,6 +565,10 @@ local function setup(opt)
if snippet_path then
extend_snippets(vim.bo[args.buf].filetype)
end

if vim.tbl_contains(opt.compleopt:get(), 'popup') then
complete_changed(args.buf)
end
end,
})
end
Expand Down

0 comments on commit 1d8e7aa

Please sign in to comment.