Skip to content

Commit 85f318b

Browse files
committed
fix: luasnip resolve documentation
Closes #437 Co-authored-by: soifou <[email protected]>
1 parent 777d6fb commit 85f318b

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

lua/blink/cmp/sources/luasnip.lua

+11-5
Original file line numberDiff line numberDiff line change
@@ -95,11 +95,17 @@ function source:resolve(item, callback)
9595
local snip = require('luasnip').get_id_snippet(item.data.snip_id)
9696

9797
local resolved_item = vim.deepcopy(item)
98-
resolved_item.detail = snip:get_docstring()
99-
resolved_item.documentation = {
100-
kind = 'markdown',
101-
value = table.concat(vim.lsp.util.convert_input_to_markdown_lines(item.data.documentation or ''), '\n'),
102-
}
98+
99+
local detail = snip:get_docstring()
100+
if type(detail) == 'table' then detail = table.concat(detail, '\n') end
101+
resolved_item.detail = detail
102+
103+
if snip.dscr then
104+
resolved_item.documentation = {
105+
kind = 'markdown',
106+
value = table.concat(vim.lsp.util.convert_input_to_markdown_lines(snip.dscr), '\n'),
107+
}
108+
end
103109

104110
callback(resolved_item)
105111
end

0 commit comments

Comments
 (0)