Skip to content

Commit

Permalink
feat(signature): added signature param docs. Fixes #421
Browse files Browse the repository at this point in the history
  • Loading branch information
folke committed Apr 16, 2023
1 parent eb6171a commit e76ae13
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions lua/noice/lsp/signature.lua
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,22 @@ function M:format_signature(sig_index, sig)
Markdown.horizontal_line(self.message)
Format.format(self.message, sig.documentation, { ft = self.ft })
end

---@type ParameterInformation[]
local params = vim.tbl_filter(function(p)
return p.documentation
end, sig.parameters or {})

local lines = {}
if #params > 0 then
for _, p in ipairs(sig.parameters) do
if p.documentation then
local pdoc = table.concat(Format.format_markdown(p.documentation or ""), "\n")
lines[#lines + 1] = "- " .. "`" .. p.label .. "`" .. " " .. pdoc
end
end
end
Format.format(self.message, table.concat(lines, "\n"), { ft = self.ft })
end

function M:format()
Expand Down

0 comments on commit e76ae13

Please sign in to comment.