mirror of
https://github.com/neovim/neovim.git
synced 2026-05-01 11:34:56 +00:00
feat(lsp): show snippet preview if completeopt=popup #32553
Problem: LSP completion does not show snippet preview. Solution: Show snippet preview if 'completeopt' includes popup.
This commit is contained in:
@@ -750,6 +750,28 @@ describe('vim.lsp.completion: item conversion', function()
|
||||
eq(1, #result.items)
|
||||
eq('foobar', result.items[1].user_data.nvim.lsp.completion_item.textEdit.newText)
|
||||
end)
|
||||
|
||||
it('shows snippet source in doc popup if completeopt include popup', function()
|
||||
exec_lua([[
|
||||
vim.opt.completeopt:append('popup')
|
||||
vim.bo.filetype = 'lua'
|
||||
]])
|
||||
local completion_list = {
|
||||
isIncomplete = false,
|
||||
items = {
|
||||
{
|
||||
insertText = 'for ${1:index}, ${2:value} in ipairs(${3:t}) do\n\t$0\nend',
|
||||
insertTextFormat = 2,
|
||||
kind = 15,
|
||||
label = 'for .. ipairs',
|
||||
sortText = '0001',
|
||||
},
|
||||
},
|
||||
}
|
||||
local result = complete('|', completion_list)
|
||||
eq('for .. ipairs', result.items[1].word)
|
||||
eq('```lua\nfor index, value in ipairs(t) do\n\t\nend\n```', result.items[1].info)
|
||||
end)
|
||||
end)
|
||||
|
||||
--- @param name string
|
||||
|
||||
Reference in New Issue
Block a user