mirror of
https://github.com/neovim/neovim.git
synced 2026-05-28 07:45:35 +00:00
fix(lsp): generate snippet preview from resolved textEdit.newText
Problem: When a resolved `CompletionItem` with kind `Snippet` populates `textEdit` instead of `insertText`, the contents are not previewed. Solution: Generate the snippet preview from `textEdit.newText` as well.
This commit is contained in:
@@ -773,9 +773,9 @@ function CompletionResolver:request(bufnr, param, selected_word)
|
||||
return
|
||||
end
|
||||
-- generate snippet preview info
|
||||
local insert_text = vim.tbl_get(result, 'insertText')
|
||||
if insert_text then
|
||||
value = ('```%s\n%s\n```'):format(vim.bo.filetype, parse_snippet(insert_text))
|
||||
local text = vim.tbl_get(result, 'insertText') or vim.tbl_get(result, 'textEdit', 'newText')
|
||||
if text then
|
||||
value = ('```%s\n%s\n```'):format(vim.bo.filetype, parse_snippet(text))
|
||||
kind = lsp.protocol.MarkupKind.Markdown
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user