Skip to content

Commit

Permalink
fix: check item.detail is type of table (#595)
Browse files Browse the repository at this point in the history
  • Loading branch information
devswi committed Sep 25, 2023
1 parent 1edca17 commit 3670766
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lua/noice/lsp/override.lua
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,18 @@ function M.setup()

local lines = item.documentation and Format.format_markdown(item.documentation) or {}
local ret = table.concat(lines, "\n")
local detail = item.detail
if detail and type(detail) == "table" then
detail = table.concat(detail, "\n")
end

if item.detail and not ret:find(item.detail, 1, true) then
if detail and not ret:find(detail, 1, true) then
local ft = self.context.filetype
local dot_index = string.find(ft, "%.")
if dot_index ~= nil then
ft = string.sub(ft, 0, dot_index - 1)
end
ret = ("```%s\n%s\n```\n%s"):format(ft, vim.trim(item.detail), ret)
ret = ("```%s\n%s\n```\n%s"):format(ft, vim.trim(detail), ret)
end
return vim.split(ret, "\n")
end
Expand Down

0 comments on commit 3670766

Please sign in to comment.