Skip to content

Commit 3c880c6

Browse files
committed
Fix #33
1 parent 0a272e8 commit 3c880c6

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

lua/lsp-status/diagnostics.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
-- Gather diagnostics
2-
local function get_all_diagnostics()
2+
local function get_all_diagnostics(bufnr)
33
local result = {}
44
local levels = {
55
errors = 'Error',
@@ -9,7 +9,7 @@ local function get_all_diagnostics()
99
}
1010

1111
for k, level in pairs(levels) do
12-
result[k] = vim.lsp.diagnostic.get_count(0, level)
12+
result[k] = vim.lsp.diagnostic.get_count(bufnr, level)
1313
end
1414

1515
return result

lua/lsp-status/statusline.lua

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,13 @@ local aliases = {
1010
pyls_ms = 'MPLS',
1111
}
1212

13-
local function statusline_lsp()
14-
if #vim.lsp.buf_get_clients() == 0 then
13+
local function statusline_lsp(bufnr)
14+
bufnr = bufnr or 0
15+
if #vim.lsp.buf_get_clients(bufnr) == 0 then
1516
return ''
1617
end
1718

18-
local buf_diagnostics = diagnostics()
19+
local buf_diagnostics = diagnostics(bufnr)
1920
local buf_messages = messages()
2021
local only_hint = true
2122
local some_diagnostics = false

0 commit comments

Comments
 (0)