mirror of
https://github.com/neovim/neovim.git
synced 2025-12-12 09:32:39 +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
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local diagnostic = {}
|
local diagnostic = {} --- @type table<string,any>
|
||||||
|
|
||||||
for i, match in ipairs(matches) do
|
for i, match in ipairs(matches) do
|
||||||
local field = groups[i]
|
local field = groups[i]
|
||||||
if field == 'severity' then
|
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
|
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
|
end
|
||||||
diagnostic[field] = match --- @type any
|
|
||||||
end
|
end
|
||||||
|
|
||||||
diagnostic = vim.tbl_extend('keep', diagnostic, defaults or {}) --- @type vim.Diagnostic
|
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
|
-- 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
|
-- 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.
|
-- foldminlines, but we don't handle it for simplicity.
|
||||||
|
--- @type integer avoid flaky error
|
||||||
adjusted = level0 - leave_line
|
adjusted = level0 - leave_line
|
||||||
leave_line = 0
|
leave_line = 0
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user