mirror of
https://github.com/neovim/neovim
synced 2025-07-16 01:01:49 +00:00
fix(diagnostic): fix flaky error
This commit is contained in:
committed by
Lewis Russell
parent
cbfc3d1cdc
commit
e34e2289c2
@ -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
|
||||
|
@ -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
|
||||
|
Reference in New Issue
Block a user