diff --git a/lua/neotest/consumers/diagnostic.lua b/lua/neotest/consumers/diagnostic.lua index 0eb4e9a..d442ee0 100644 --- a/lua/neotest/consumers/diagnostic.lua +++ b/lua/neotest/consumers/diagnostic.lua @@ -98,9 +98,16 @@ local function init(client) local mark_code = api.nvim_buf_get_lines(bufnr, mark[1], mark[1] + 1, false)[1] if mark_code == self.error_code_lines[pos_id][error_i] then + local col = mark_code:find("%S") + if col then + col = col - 1 + else + col = 0 + end + diagnostics[#diagnostics + 1] = { lnum = mark[1], - col = mark_code:find("%S") - 1, + col = col, message = error.message, source = "neotest", severity = config.diagnostic.severity,