fix(treesitter): nil access when running string parser async

This commit is contained in:
Riley Bruins
2025-01-30 13:34:46 -08:00
committed by Christian Clason
parent f3381a8b64
commit 096ae3bfd7
2 changed files with 23 additions and 9 deletions

View File

@@ -504,6 +504,15 @@ end]]
eq({ 0, 0, 0, 13 }, ret)
end)
it('can run async parses with string parsers', function()
local ret = exec_lua(function()
local parser = vim.treesitter.get_string_parser('int foo = 42;', 'c')
return { parser:parse(nil, function() end)[1]:root():range() }
end)
eq({ 0, 0, 0, 13 }, ret)
end)
it('allows to run queries with string parsers', function()
local txt = [[
int foo = 42;