fix(treesitter): restore highlighting on 32 bit systems #39091

Problem: Treesitter highlighting regressed on 32-bit builds because ranges that should cover the whole buffer were corrupted when passed into Lua.

Solution: Round-trip those range values through Lua and validate them so treesitter sees the same ranges on 32 and 64-bit builds.
(cherry picked from commit 3838a2579e)
This commit is contained in:
Barrett Ruth
2026-04-16 03:59:20 -04:00
committed by github-actions[bot]
parent efc136850d
commit 2ea9ed32e4
2 changed files with 39 additions and 12 deletions

View File

@@ -90,6 +90,23 @@ describe('treesitter parser API', function()
eq(true, exec_lua('return parser:parse()[1] == tree2'))
end)
it('preserves full-document included ranges', function()
insert([[
local _ = 1
]])
eq(
{
{ 0, 0, 0, 4294967295, 4294967295, 4294967295 },
},
exec_lua(function()
local parser = vim.treesitter.get_parser(0, 'lua')
local tree = parser:parse()[1]
return tree:included_ranges(true)
end)
)
end)
it('respects eol settings when parsing buffer', function()
insert([[
int main() {