feat(diagnotics): add disable_coordinates option (#2477)
This commit is contained in:
@@ -485,6 +485,7 @@ builtin.lsp_dynamic_workspace_symbols = require_on_exported_call("telescope.buil
|
||||
---@field no_sign boolean: hide DiagnosticSigns from Results (default: false)
|
||||
---@field line_width number: set length of diagnostic entry text in Results
|
||||
---@field namespace number: limit your diagnostics to a specific namespace
|
||||
---@field disable_coordinates boolean: don't show the line & row numbers (default: false)
|
||||
builtin.diagnostics = require_on_exported_call("telescope.builtin.__diagnostics").get
|
||||
|
||||
local apply_config = function(mod)
|
||||
|
||||
@@ -1152,8 +1152,15 @@ function make_entry.gen_from_diagnostics(opts)
|
||||
return signs
|
||||
end)()
|
||||
|
||||
local sign_width
|
||||
if opts.disable_coordinates then
|
||||
sign_width = signs ~= nil and 2 or 0
|
||||
else
|
||||
sign_width = signs ~= nil and 10 or 8
|
||||
end
|
||||
|
||||
local display_items = {
|
||||
{ width = signs ~= nil and 10 or 8 },
|
||||
{ width = sign_width },
|
||||
{ remaining = true },
|
||||
}
|
||||
local line_width = vim.F.if_nil(opts.line_width, 0.5)
|
||||
@@ -1171,8 +1178,9 @@ function make_entry.gen_from_diagnostics(opts)
|
||||
|
||||
-- add styling of entries
|
||||
local pos = string.format("%4d:%2d", entry.lnum, entry.col)
|
||||
local line_info_text = signs and signs[entry.type] .. " " or ""
|
||||
local line_info = {
|
||||
(signs and signs[entry.type] .. " " or "") .. pos,
|
||||
opts.disable_coordinates and line_info_text or line_info_text .. pos,
|
||||
"DiagnosticSign" .. entry.type,
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user