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 17, 2023
1 parent 138fac5 commit d031b6b
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions lua/epo/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,15 @@ local function lspkind(kind)
end

local function show_info(bufnr)
local info = vim.tbl_get(vim.v.event, 'completed_item', 'info')
local data = vim.fn.complete_info()
if data.preview_winid and data.preview_bufnr then
vim.wo[data.preview_winid].conceallevel = 2
vim.wo[data.preview_winid].concealcursor = 'niv'
vim.treesitter.start(data.preview_bufnr, 'markdown')
return
end

local info = vim.tbl_get(vim.v.event, 'completed_item', 'info')
local selected = data.selected
if not info or #info == 0 then
local param =
Expand All @@ -76,10 +83,13 @@ local function show_info(bufnr)
return
end
local value = vim.tbl_get(result, 'documentation', 'value')
local kind = vim.tbl_get(result, 'documentation', 'kind')
if value then
local wininfo = api.nvim_complete_set_info(selected, value)
api.nvim_set_option_value('filetype', kind or '', { buf = wininfo.bufnr })
local wininfo = api.nvim_complete_set(selected, { info = value })
if wininfo.winid and wininfo.bufnr then
vim.wo[wininfo.winid].conceallevel = 2
vim.wo[wininfo.winid].concealcursor = 'niv'
vim.treesitter.start(wininfo.bufnr, 'markdown')
end
end
end, bufnr)
end
Expand Down Expand Up @@ -483,10 +493,6 @@ local function auto_complete(client, bufnr)
debounce(client, args.buf, triggerKind, triggerChar)
end,
})
-- local build = vim.version().build
-- if build:match('^g') or build:match('dirty') then
-- api.nvim_set_option_value('completeopt', 'menu,noinsert,popup', { scope = 'global' })
-- end
end

local function register_cap()
Expand Down Expand Up @@ -521,6 +527,8 @@ local function setup(opt)
kind_format = opt.kind_format or function(k)
return k:lower():sub(1, 1)
end
--make sure your neovim is newer enough
api.nvim_set_option_value('completeopt', 'menu,noinsert,popup', { scope = 'global' })

-- Usually I just use one client for completion so just one
api.nvim_create_autocmd('LspAttach', {
Expand Down

0 comments on commit d031b6b

Please sign in to comment.