feat: add diagnostic sources option vim_lsp (#151)

This commit is contained in:
Yusei Ueno 2021-03-29 23:53:19 +09:00 committed by GitHub
parent 78b8260084
commit a2721e5ada
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 2 deletions

View File

@ -219,7 +219,7 @@ In addition, some components have unique options.
Option | Default | Behaviour | Format
:------: | :------: | :----: | :---:
sources | `nil` | displays diagnostic count from defined source | array containing one or many string from set `{'nvim_lsp', 'coc', 'ale'}`
sources | `nil` | displays diagnostic count from defined source | array containing one or many string from set `{'nvim_lsp', 'coc', 'ale', 'vim_lsp'}`
sections | `{'error', 'warn', 'info'}` | displays diagnostics of defined severity | array containing one or many string from set `{'error', 'warn', 'info'}`
color_error | `DiffDelete` foreground color | changes diagnostic's error section foreground color | color in `#rrggbb` format
color_warn | `DiffText` foreground color | changes diagnostic's warn section foreground color | color in `#rrggbb` format

View File

@ -277,7 +277,7 @@ List of options are given below.
• sources (nil)
displays diagnostic count from defined source.
array containing one or many string from set
{'nvim_lsp', 'coc', 'ale'}
{'nvim_lsp', 'coc', 'ale', 'vim_lsp'}
• sections ({'error', 'warn', 'info'})
displays diagnostics of defined severity.

View File

@ -32,6 +32,14 @@ local diagnostic_sources = {
else
return 0, 0, 0
end
end,
vim_lsp = function()
local ok, data = pcall(vim.fn['lsp#get_buffer_diagnostics_counts'])
if ok then
return data.error, data.warning, data.information
else
return 0, 0, 0
end
end
}