mirror of
https://github.com/neovim/neovim.git
synced 2026-03-28 03:12:00 +00:00
refactor: integer functions, optimize asserts #34112
refactor(lua): add integer coercion helpers Add vim._tointeger() and vim._ensure_integer(), including optional base support, and switch integer-only tonumber()/assert call sites in the Lua runtime to use them. This also cleans up related integer parsing in LSP, health, loader, URI, tohtml, and Treesitter code. supported by AI
This commit is contained in:
@@ -2857,7 +2857,7 @@ function M.match(str, pat, groups, severity_map, defaults)
|
||||
if field == 'severity' then
|
||||
diagnostic[field] = severity_map[match]
|
||||
elseif field == 'lnum' or field == 'end_lnum' or field == 'col' or field == 'end_col' then
|
||||
diagnostic[field] = assert(tonumber(match)) - 1
|
||||
diagnostic[field] = vim._ensure_integer(match) - 1
|
||||
elseif field then
|
||||
diagnostic[field] = match
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user