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:
Lewis Russell
2026-03-12 15:04:05 +00:00
committed by GitHub
parent 2fe07cc965
commit ce1154048b
30 changed files with 144 additions and 95 deletions

View File

@@ -20,7 +20,7 @@ function methods.shutdown(_, callback)
end
local get_confirm_bufnr = function(uri)
return tonumber(uri:match('^nvim%-pack://confirm#(%d+)$'))
return vim._tointeger(uri:match('^nvim%-pack://confirm#(%d+)$'))
end
local group_header_pattern = '^# (%S+)'