feat: add workspace diagnostics source (#618)
* feat: add workspace diagnostics source * doc: add nvim_workspace_diagnostics to list of sources Co-authored-by: Shadman <13149513+shadmansaleh@users.noreply.github.com>
This commit is contained in:
parent
33f03620c3
commit
0521ada344
|
@ -512,7 +512,7 @@ sections = {
|
||||||
'diagnostics',
|
'diagnostics',
|
||||||
|
|
||||||
-- Table of diagnostic sources, available sources are:
|
-- Table of diagnostic sources, available sources are:
|
||||||
-- 'nvim_lsp', 'nvim_diagnostic', 'coc', 'ale', 'vim_lsp'.
|
-- 'nvim_lsp', 'nvim_diagnostic', 'nvim_workspace_diagnostic', 'coc', 'ale', 'vim_lsp'.
|
||||||
-- or a function that returns a table as such:
|
-- or a function that returns a table as such:
|
||||||
-- { error=error_cnt, warn=warn_cnt, info=info_cnt, hint=hint_cnt }
|
-- { error=error_cnt, warn=warn_cnt, info=info_cnt, hint=hint_cnt }
|
||||||
sources = { 'nvim_diagnostic', 'coc' },
|
sources = { 'nvim_diagnostic', 'coc' },
|
||||||
|
|
|
@ -530,7 +530,7 @@ Component specific options These are options that are available on
|
||||||
'diagnostics',
|
'diagnostics',
|
||||||
|
|
||||||
-- Table of diagnostic sources, available sources are:
|
-- Table of diagnostic sources, available sources are:
|
||||||
-- 'nvim_lsp', 'nvim_diagnostic', 'coc', 'ale', 'vim_lsp'.
|
-- 'nvim_lsp', 'nvim_diagnostic', 'nvim_workspace_diagnostic', 'coc', 'ale', 'vim_lsp'.
|
||||||
-- or a function that returns a table as such:
|
-- or a function that returns a table as such:
|
||||||
-- { error=error_cnt, warn=warn_cnt, info=info_cnt, hint=hint_cnt }
|
-- { error=error_cnt, warn=warn_cnt, info=info_cnt, hint=hint_cnt }
|
||||||
sources = { 'nvim_diagnostic', 'coc' },
|
sources = { 'nvim_diagnostic', 'coc' },
|
||||||
|
|
|
@ -30,6 +30,19 @@ M.sources = {
|
||||||
end
|
end
|
||||||
return error_count, warning_count, info_count, hint_count
|
return error_count, warning_count, info_count, hint_count
|
||||||
end,
|
end,
|
||||||
|
nvim_workspace_diagnostic = function()
|
||||||
|
local diag_severity = vim.diagnostic.severity
|
||||||
|
|
||||||
|
local function workspace_diag(severity)
|
||||||
|
local count = vim.diagnostic.get(nil, {severity = severity})
|
||||||
|
return vim.tbl_count(count)
|
||||||
|
end
|
||||||
|
|
||||||
|
return workspace_diag(diag_severity.ERROR),
|
||||||
|
workspace_diag(diag_severity.WARN),
|
||||||
|
workspace_diag(diag_severity.HINT),
|
||||||
|
workspace_diag(diag_severity.INFO)
|
||||||
|
end,
|
||||||
nvim_diagnostic = function()
|
nvim_diagnostic = function()
|
||||||
local diagnostics = vim.diagnostic.get(0)
|
local diagnostics = vim.diagnostic.get(0)
|
||||||
local count = { 0, 0, 0, 0 }
|
local count = { 0, 0, 0, 0 }
|
||||||
|
|
Loading…
Reference in New Issue