Skip to content

Commit

Permalink
fix: luasnip resolve documentation
Browse files Browse the repository at this point in the history
Closes #437
Co-authored-by: soifou <[email protected]>
  • Loading branch information
Saghen committed Dec 3, 2024
1 parent 777d6fb commit 85f318b
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions lua/blink/cmp/sources/luasnip.lua
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,17 @@ function source:resolve(item, callback)
local snip = require('luasnip').get_id_snippet(item.data.snip_id)

local resolved_item = vim.deepcopy(item)
resolved_item.detail = snip:get_docstring()
resolved_item.documentation = {
kind = 'markdown',
value = table.concat(vim.lsp.util.convert_input_to_markdown_lines(item.data.documentation or ''), '\n'),
}

local detail = snip:get_docstring()
if type(detail) == 'table' then detail = table.concat(detail, '\n') end
resolved_item.detail = detail

if snip.dscr then
resolved_item.documentation = {
kind = 'markdown',
value = table.concat(vim.lsp.util.convert_input_to_markdown_lines(snip.dscr), '\n'),
}
end

callback(resolved_item)
end
Expand Down

0 comments on commit 85f318b

Please sign in to comment.