Skip to content

Commit

Permalink
feat: use markdown to render hover
Browse files Browse the repository at this point in the history
  • Loading branch information
folke committed Jul 22, 2023
1 parent 31557ea commit 835b87d
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions lua/trouble/view.lua
Expand Up @@ -156,11 +156,17 @@ function View:setup(opts)
keys = { keys }
end
for _, key in pairs(keys) do
vim.api.nvim_buf_set_keymap(self.buf, "n", key, [[<cmd>lua require("trouble").action("]] .. action .. [[")<cr>]], {
silent = true,
noremap = true,
nowait = true,
})
vim.api.nvim_buf_set_keymap(
self.buf,
"n",
key,
[[<cmd>lua require("trouble").action("]] .. action .. [[")<cr>]],
{
silent = true,
noremap = true,
nowait = true,
}
)
end
end

Expand Down Expand Up @@ -446,13 +452,7 @@ function View:hover(opts)
if not (item and item.full_text) then
return
end

local lines = {}
for line in item.full_text:gmatch("([^\n]*)\n?") do
table.insert(lines, line)
end

vim.lsp.util.open_floating_preview(lines, "plaintext", { border = "single" })
vim.lsp.util.open_floating_preview(vim.split(item.full_text, "\n"), "markdown", { border = "single" })
end

function View:jump(opts)
Expand Down

0 comments on commit 835b87d

Please sign in to comment.