Skip to content

Commit 4073f76

Browse files
committed
Fix #70: Update autocmd name
Also fixes use of deprecated diagnostics function
1 parent e8e5303 commit 4073f76

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

lua/lsp-status.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ local function on_attach(client)
8383
messaging.register_client(client.id, client.name)
8484
vim.api.nvim_command('augroup lsp_aucmds')
8585
vim.api.nvim_command('au! * <buffer>')
86-
vim.api.nvim_command('au User LspDiagnosticsChanged lua require("lsp-status/redraw").redraw()')
86+
vim.api.nvim_command('au User DiagnosticChanged lua require("lsp-status/redraw").redraw()')
8787

8888
-- If the client is a documentSymbolProvider, set up an autocommand
8989
-- to update the containing symbol

lua/lsp-status/diagnostics.lua

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
-- Gather diagnostics
2+
local levels = {
3+
errors = vim.diagnostic.severity.ERROR,
4+
warnings = vim.diagnostic.severity.WARN,
5+
info = vim.diagnostic.severity.INFO,
6+
hints = vim.diagnostic.severity.HINT,
7+
}
8+
29
local function get_all_diagnostics(bufnr)
310
local result = {}
4-
local levels = {
5-
errors = 'Error',
6-
warnings = 'Warning',
7-
info = 'Information',
8-
hints = 'Hint'
9-
}
10-
1111
for k, level in pairs(levels) do
12-
result[k] = vim.lsp.diagnostic.get_count(bufnr, level)
12+
result[k] = #vim.diagnostic.get(bufnr, { severity = level })
1313
end
1414

1515
return result

0 commit comments

Comments
 (0)