Skip to content

Commit 8bf8358

Browse files
authored
fix(ui): set diagnostic bufnr (#149)
1 parent 5a24e3b commit 8bf8358

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

lua/crates/ui.lua

+5-3
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,13 @@ local CUSTOM_NS = vim.api.nvim_create_namespace("crates.nvim")
4242
---@type integer
4343
local DIAGNOSTIC_NS = vim.api.nvim_create_namespace("crates.nvim.diagnostic")
4444

45+
---@param buf integer
4546
---@param d CratesDiagnostic
4647
---@return vim.Diagnostic
47-
local function to_vim_diagnostic(d)
48+
local function to_vim_diagnostic(buf, d)
4849
---@type vim.Diagnostic
4950
return {
51+
bufnr = buf,
5052
lnum = d.lnum,
5153
end_lnum = d.end_lnum,
5254
col = d.col,
@@ -68,11 +70,11 @@ function M.display_diagnostics(buf, diagnostics, custom_diagnostics)
6870

6971
local buf_state = M.get_or_init(buf)
7072
for _, d in ipairs(diagnostics) do
71-
local vim_diagnostic = to_vim_diagnostic(d)
73+
local vim_diagnostic = to_vim_diagnostic(buf, d)
7274
table.insert(buf_state.diagnostics, vim_diagnostic)
7375
end
7476
for _, d in ipairs(custom_diagnostics) do
75-
local vim_diagnostic = to_vim_diagnostic(d)
77+
local vim_diagnostic = to_vim_diagnostic(buf, d)
7678
table.insert(buf_state.custom_diagnostics, vim_diagnostic)
7779
end
7880

0 commit comments

Comments
 (0)