commit e34e2289c22834239e0522b7331f17fdfb3705e0
parent cbfc3d1cdc199ce65368a2f40dc4b1ddc4331714
Author: Lewis Russell <lewis6991@gmail.com>
Date: Fri, 4 Jul 2025 17:29:51 +0100
fix(diagnostic): fix flaky error
Diffstat:
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/runtime/lua/vim/diagnostic.lua b/runtime/lua/vim/diagnostic.lua
@@ -2600,16 +2600,17 @@ function M.match(str, pat, groups, severity_map, defaults)
return
end
- local diagnostic = {}
+ local diagnostic = {} --- @type table<string,any>
for i, match in ipairs(matches) do
local field = groups[i]
if field == 'severity' then
- match = severity_map[match]
+ diagnostic[field] = severity_map[match]
elseif field == 'lnum' or field == 'end_lnum' or field == 'col' or field == 'end_col' then
- match = assert(tonumber(match)) - 1
+ diagnostic[field] = assert(tonumber(match)) - 1
+ elseif field then
+ diagnostic[field] = match
end
- diagnostic[field] = match --- @type any
end
diagnostic = vim.tbl_extend('keep', diagnostic, defaults or {}) --- @type vim.Diagnostic
diff --git a/runtime/lua/vim/treesitter/_fold.lua b/runtime/lua/vim/treesitter/_fold.lua
@@ -169,6 +169,7 @@ local function compute_folds_levels(bufnr, info, srow, erow, callback)
-- If this line ends a fold f1 and starts a fold f2, then move f1's end to the previous line
-- so that f2 gets the correct level on this line. This may reduce the size of f1 below
-- foldminlines, but we don't handle it for simplicity.
+ --- @type integer avoid flaky error
adjusted = level0 - leave_line
leave_line = 0
end