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:
fdschmidt93
2021-03-04 15:01:17 +01:00
committed by GitHub
parent 8dc00b08aa
commit 908752fc67
5 changed files with 43 additions and 28 deletions

View File

@@ -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,