feat: workspace diagnostics, jump to and improved styling (#599)
Changes: `Telescope lsp_diagnostics` is now `Telescope lsp_document_diagnostics` New: `Telescope lsp_workspace_diagnostics` Co-authored-by: Fabian David Schmidt <fabian.david.schmidt@hotmail.com> Co-authored-by: elianiva <dicha.arkana03@gmail.com>
This commit is contained in:
@@ -862,15 +862,16 @@ function make_entry.gen_from_lsp_diagnostics(opts)
|
||||
for _, v in pairs(lsp_type_diagnostic) do
|
||||
signs[v] = vim.trim(vim.fn.sign_getdefined("LspDiagnosticsSign" .. v)[1].text)
|
||||
end
|
||||
-- expose line width for longer msg if opts.hide_filename
|
||||
local line_width = utils.get_default(opts.line_width, 48)
|
||||
|
||||
local layout = {
|
||||
{ width = 9 },
|
||||
{ remaining = true }
|
||||
}
|
||||
local line_width = utils.get_default(opts.line_width, 47)
|
||||
if not opts.hide_filename then table.insert(layout, 2, {width = line_width}) end
|
||||
local displayer = entry_display.create {
|
||||
separator = "▏",
|
||||
items = {
|
||||
{ width = 11 },
|
||||
{ width = line_width },
|
||||
{ remaining = true }
|
||||
}
|
||||
items = layout
|
||||
}
|
||||
|
||||
local make_display = function(entry)
|
||||
@@ -890,12 +891,10 @@ function make_entry.gen_from_lsp_diagnostics(opts)
|
||||
string.format("%s %s", signs[entry.type], pos),
|
||||
string.format("LspDiagnosticsDefault%s", entry.type)
|
||||
}
|
||||
-- remove line break to avoid display issues
|
||||
local text = string.format("%-" .. line_width .."s", entry.text:gsub(".* | ", ""):gsub("[\n]", ""))
|
||||
|
||||
return displayer {
|
||||
line_info,
|
||||
text,
|
||||
entry.text,
|
||||
filename,
|
||||
}
|
||||
end
|
||||
@@ -912,7 +911,6 @@ function make_entry.gen_from_lsp_diagnostics(opts)
|
||||
or ''
|
||||
) .. ' ' .. entry.text,
|
||||
display = make_display,
|
||||
bufnr = entry.bufnr,
|
||||
filename = filename,
|
||||
type = entry.type,
|
||||
lnum = entry.lnum,
|
||||
|
||||
Reference in New Issue
Block a user