mirror of
https://github.com/neovim/neovim.git
synced 2026-04-02 05:39:26 +00:00
fix(lsp): highlight snippet preview when server can't completionItem/resolve (#38534)
Problem: The snippet preview is not being highlighted by treesitter for completion items from servers which don't support `completionItem/resolve` (like gopls). This was broken by #38428. Solution: Call `update_popup_window` after updating the completion item with the snippet preview. I've added assertions to the `selecting an item triggers completionItem/resolve + (snippet) preview` test case which covers the snippet preview being shown since no tests failed when I removed the `nvim__complete_set` call which actually populates the preview on this codepath.
This commit is contained in:
@@ -803,10 +803,11 @@ local function on_completechanged(group, bufnr)
|
||||
then
|
||||
-- Shows snippet preview in doc popup if completeopt=popup.
|
||||
local text = parse_snippet(lsp_item.insertText or lsp_item.textEdit.newText)
|
||||
api.nvim__complete_set(
|
||||
local windata = api.nvim__complete_set(
|
||||
data.selected,
|
||||
{ info = ('```%s\n%s\n```'):format(vim.bo.filetype, text) }
|
||||
)
|
||||
update_popup_window(windata.winid, windata.bufnr, protocol.MarkupKind.Markdown)
|
||||
end
|
||||
return
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user