mirror of
https://github.com/LunarVim/LunarVim.git
synced 2024-09-20 18:45:08 +02:00
[Bugfix] Wrap the gl
floating window diagnostics (#1588)
This commit is contained in:
parent
f5c03643a2
commit
55d9a15a08
1 changed files with 5 additions and 3 deletions
|
@ -126,18 +126,20 @@ function M.show_line_diagnostics()
|
|||
if diagnostic.code then
|
||||
diags[i].message = string.format("%s [%s]", diags[i].message, diagnostic.code)
|
||||
end
|
||||
if diags[i].message:len() > width then
|
||||
width = string.len(diags[i].message)
|
||||
end
|
||||
width = math.max(width, diags[i].message:len())
|
||||
end
|
||||
local max_width = vim.fn.winwidth(0) - 10
|
||||
width = math.min(width, max_width)
|
||||
|
||||
opts = vim.lsp.util.make_floating_popup_options(width, height, opts)
|
||||
opts["style"] = "minimal"
|
||||
opts["border"] = "rounded"
|
||||
opts["focusable"] = true
|
||||
|
||||
vim.api.nvim_buf_set_option(bufnr, "bufhidden", "wipe")
|
||||
local winnr = vim.api.nvim_open_win(bufnr, false, opts)
|
||||
vim.api.nvim_win_set_option(winnr, "winblend", 0)
|
||||
vim.api.nvim_win_set_option(winnr, "wrap", true)
|
||||
vim.api.nvim_buf_set_var(bufnr, "lsp_floating_window", winnr)
|
||||
for i, diag in ipairs(diags) do
|
||||
local message = diag.message:gsub("[\n\r]", " ")
|
||||
|
|
Loading…
Reference in a new issue