feat(diagnostics): add diagnostics.severity (#1755)
* feat: Support diagnostics severity * fix: Revert Hunk * feat: Supports min/max severity * feat: Supports min/max severity: tidy doc * feat: Supports min/max severity: tidy doc * feat: Supports min/max severity: tidy doc Co-authored-by: Alexander Courtis <alex@courtis.org>
This commit is contained in:
committed by
GitHub
parent
cc18122be1
commit
68a2a0971e
@@ -291,6 +291,10 @@ Subsequent calls to setup will replace the previous configuration.
|
|||||||
enable = false,
|
enable = false,
|
||||||
show_on_dirs = false,
|
show_on_dirs = false,
|
||||||
debounce_delay = 50,
|
debounce_delay = 50,
|
||||||
|
severity = {
|
||||||
|
min = vim.diagnostic.severity.HINT,
|
||||||
|
max = vim.diagnostic.severity.ERROR
|
||||||
|
},
|
||||||
icons = {
|
icons = {
|
||||||
hint = "",
|
hint = "",
|
||||||
info = "",
|
info = "",
|
||||||
@@ -365,6 +369,9 @@ Subsequent calls to setup will replace the previous configuration.
|
|||||||
ignore = {},
|
ignore = {},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
notify = {
|
||||||
|
threshold = vim.log.levels.INFO,
|
||||||
|
},
|
||||||
log = {
|
log = {
|
||||||
enable = false,
|
enable = false,
|
||||||
truncate = false,
|
truncate = false,
|
||||||
@@ -379,9 +386,6 @@ Subsequent calls to setup will replace the previous configuration.
|
|||||||
watcher = false,
|
watcher = false,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
notify = {
|
|
||||||
threshold = vim.log.levels.INFO,
|
|
||||||
},
|
|
||||||
} -- END_DEFAULT_OPTS
|
} -- END_DEFAULT_OPTS
|
||||||
<
|
<
|
||||||
|
|
||||||
@@ -532,6 +536,13 @@ Configuration options for the system open command.
|
|||||||
*nvim-tree.diagnostics*
|
*nvim-tree.diagnostics*
|
||||||
Show LSP and COC diagnostics in the signcolumn
|
Show LSP and COC diagnostics in the signcolumn
|
||||||
|
|
||||||
|
`NOTE`: it will use the default diagnostic color groups to highlight the signs.
|
||||||
|
If you wish to customize, you can override these groups:
|
||||||
|
- `NvimTreeLspDiagnosticsError`
|
||||||
|
- `NvimTreeLspDiagnosticsWarning`
|
||||||
|
- `NvimTreeLspDiagnosticsInformation`
|
||||||
|
- `NvimTreeLspDiagnosticsHint`
|
||||||
|
|
||||||
*nvim-tree.diagnostics.enable*
|
*nvim-tree.diagnostics.enable*
|
||||||
Enable/disable the feature.
|
Enable/disable the feature.
|
||||||
Type: `boolean`, Default: `false`
|
Type: `boolean`, Default: `false`
|
||||||
@@ -548,12 +559,16 @@ Show LSP and COC diagnostics in the signcolumn
|
|||||||
Icons for diagnostic severity.
|
Icons for diagnostic severity.
|
||||||
Type: `table`, Default: `{ hint = "", info = "", warning = "", error = "" }`
|
Type: `table`, Default: `{ hint = "", info = "", warning = "", error = "" }`
|
||||||
|
|
||||||
`NOTE`: it will use the default diagnostic color groups to highlight the signs.
|
*nvim-tree.diagnostics.severity*
|
||||||
If you wish to customize, you can override these groups:
|
Severity for which the diagnostics will be displayed. See |diagnostic-severity|
|
||||||
- `NvimTreeLspDiagnosticsError`
|
|
||||||
- `NvimTreeLspDiagnosticsWarning`
|
*nvim-tree.diagnostics.severity.min*
|
||||||
- `NvimTreeLspDiagnosticsInformation`
|
Minimum severity.
|
||||||
- `NvimTreeLspDiagnosticsHint`
|
Type: |vim.diagnostic.severity|, Default: `vim.diagnostic.severity.HINT`
|
||||||
|
|
||||||
|
*nvim-tree.diagnostics.severity.max*
|
||||||
|
Maximum severity.
|
||||||
|
Type: |vim.diagnostic.severity|, Default: `vim.diagnostic.severity.ERROR`
|
||||||
|
|
||||||
*nvim-tree.git*
|
*nvim-tree.git*
|
||||||
Git integration with icons and colors.
|
Git integration with icons and colors.
|
||||||
|
|||||||
@@ -569,6 +569,10 @@ local DEFAULT_OPTS = { -- BEGIN_DEFAULT_OPTS
|
|||||||
enable = false,
|
enable = false,
|
||||||
show_on_dirs = false,
|
show_on_dirs = false,
|
||||||
debounce_delay = 50,
|
debounce_delay = 50,
|
||||||
|
severity = {
|
||||||
|
min = vim.diagnostic.severity.HINT,
|
||||||
|
max = vim.diagnostic.severity.ERROR,
|
||||||
|
},
|
||||||
icons = {
|
icons = {
|
||||||
hint = "",
|
hint = "",
|
||||||
info = "",
|
info = "",
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ end
|
|||||||
local function from_nvim_lsp()
|
local function from_nvim_lsp()
|
||||||
local buffer_severity = {}
|
local buffer_severity = {}
|
||||||
|
|
||||||
for _, diagnostic in ipairs(vim.diagnostic.get()) do
|
for _, diagnostic in ipairs(vim.diagnostic.get(nil, { severity = M.severity })) do
|
||||||
local buf = diagnostic.bufnr
|
local buf = diagnostic.bufnr
|
||||||
if vim.api.nvim_buf_is_valid(buf) then
|
if vim.api.nvim_buf_is_valid(buf) then
|
||||||
local bufname = vim.api.nvim_buf_get_name(buf)
|
local bufname = vim.api.nvim_buf_get_name(buf)
|
||||||
@@ -140,6 +140,7 @@ local links = {
|
|||||||
function M.setup(opts)
|
function M.setup(opts)
|
||||||
M.enable = opts.diagnostics.enable
|
M.enable = opts.diagnostics.enable
|
||||||
M.debounce_delay = opts.diagnostics.debounce_delay
|
M.debounce_delay = opts.diagnostics.debounce_delay
|
||||||
|
M.severity = opts.diagnostics.severity
|
||||||
|
|
||||||
if M.enable then
|
if M.enable then
|
||||||
log.line("diagnostics", "setup")
|
log.line("diagnostics", "setup")
|
||||||
|
|||||||
Reference in New Issue
Block a user