summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyren223 <contact@kyren.codes>2025-12-04 18:36:57 +0200
committerKyren223 <contact@kyren.codes>2025-12-04 18:36:57 +0200
commit13e53a09df876e422290c878d5d7ed119187eec0 (patch)
tree6276a6ae5f05ea1dcbe3184fe496d5aba319e282
parent6fe376ca7d1e7a4ddd367ce3dac948733a09ee95 (diff)
Add support for MSVC error format
-rw-r--r--.config/nvim/lua/extra.lua25
1 files changed, 22 insertions, 3 deletions
diff --git a/.config/nvim/lua/extra.lua b/.config/nvim/lua/extra.lua
index 6c3d7b3..66f19f8 100644
--- a/.config/nvim/lua/extra.lua
+++ b/.config/nvim/lua/extra.lua
@@ -478,18 +478,37 @@ function JumpToError(direction)
local error_parsers = {
function(line)
+ -- Clang: ABS:LINE:COL: error: ...
local file, lnum = line:match('^(.-):(%d+):%d+:%s+error:')
if file and lnum then
return { file = file, line = tonumber(lnum) }
end
end,
- function(_)
+
+ function(line)
+ -- MSVC: PATH(LINE): error ...
+ -- Z:\home\kyren\projects\krypton\src\krypton\libkrypton.c(22): error C2220: ...
+ -- Z:\home\kyren\projects\krypton\src\krypton\libkrypton.c(22): warning C4018: ...
+ local file, lnum, kind = line:match('^(.-)%((%d+)%)%:%s*(%a+)')
+ if file and lnum and kind then
+ kind = kind:lower()
+
+ -- Convert Z:\home\... to /home/...
+ -- Only if it matches the expected WSL mount pattern
+ local wsl_path = file:gsub('^Z:\\', '/'):gsub('\\', '/')
+
+ return {
+ file = wsl_path,
+ line = tonumber(lnum),
+ kind = kind,
+ }
+ end
return nil
end,
}
local lines = vim.api.nvim_buf_get_lines(BuildTerminalBuf, 0, -1, false)
- -- vim.notify("Build buffer line count: " .. #lines, "warn")
+ -- vim.notify('Build buffer line count: ' .. #lines, 'warn')
local errors = {}
for _, line in ipairs(lines) do
@@ -502,7 +521,7 @@ function JumpToError(direction)
end
end
- -- vim.notify("Error count: " .. #errors, "warn")
+ -- vim.notify('Error count: ' .. #errors, 'warn')
if #errors == 0 then
return
end