diff options
author | Alvaro Muñoz <alvaro@pwntester.com> | 2020-02-26 20:22:14 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-26 20:22:14 +0100 |
commit | ad745f9da289a56035b8c759cc8fac1b40a44558 (patch) | |
tree | d7ccdb603c4665fed5ed627de4cfeb714b1000c1 /runtime/lua/vim/lsp/util.lua | |
parent | ca8699378c765017575c102f3da8347833159a6c (diff) | |
download | rneovim-ad745f9da289a56035b8c759cc8fac1b40a44558.tar.gz rneovim-ad745f9da289a56035b8c759cc8fac1b40a44558.tar.bz2 rneovim-ad745f9da289a56035b8c759cc8fac1b40a44558.zip |
add support to show diagnostics count in statusline (#11641)
* add support to show diagnostics count in statusline
* documentation
Diffstat (limited to 'runtime/lua/vim/lsp/util.lua')
-rw-r--r-- | runtime/lua/vim/lsp/util.lua | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/runtime/lua/vim/lsp/util.lua b/runtime/lua/vim/lsp/util.lua index 9c67f62e21..59300647b5 100644 --- a/runtime/lua/vim/lsp/util.lua +++ b/runtime/lua/vim/lsp/util.lua @@ -743,6 +743,18 @@ do api.nvim_buf_set_virtual_text(bufnr, diagnostic_ns, line, virt_texts, {}) end end + function M.buf_diagnostics_count(kind) + local bufnr = vim.api.nvim_get_current_buf() + local buffer_line_diagnostics = all_buffer_diagnostics[bufnr] + if not buffer_line_diagnostics then return end + local count = 0 + for _, line_diags in pairs(buffer_line_diagnostics) do + for _, diag in ipairs(line_diags) do + if protocol.DiagnosticSeverity[kind] == diag.severity then count = count + 1 end + end + end + return count + end end local position_sort = sort_by_key(function(v) |