Skip to content

Commit e76ae13

Browse files
committed
feat(signature): added signature param docs. Fixes #421
1 parent eb6171a commit e76ae13

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

lua/noice/lsp/signature.lua

+16
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,22 @@ function M:format_signature(sig_index, sig)
207207
Markdown.horizontal_line(self.message)
208208
Format.format(self.message, sig.documentation, { ft = self.ft })
209209
end
210+
211+
---@type ParameterInformation[]
212+
local params = vim.tbl_filter(function(p)
213+
return p.documentation
214+
end, sig.parameters or {})
215+
216+
local lines = {}
217+
if #params > 0 then
218+
for _, p in ipairs(sig.parameters) do
219+
if p.documentation then
220+
local pdoc = table.concat(Format.format_markdown(p.documentation or ""), "\n")
221+
lines[#lines + 1] = "- " .. "`" .. p.label .. "`" .. " " .. pdoc
222+
end
223+
end
224+
end
225+
Format.format(self.message, table.concat(lines, "\n"), { ft = self.ft })
210226
end
211227

212228
function M:format()

0 commit comments

Comments
 (0)