feat(treesitter)!: don't parse tree in get_parser() or start()

**Problem:** `vim.treesitter.get_parser()` and `vim.treesitter.start()`
both parse the tree before returning it. This is problematic because if
this is a sync parse, it will stall the editor on large files. If it is
an async parse, the functions return stale trees.

**Solution:** Remove this parsing side effect and leave it to the user
to parse the returned trees, either synchronously or asynchronously.
This commit is contained in:
Riley Bruins
2024-12-20 16:23:52 -08:00
parent 45e606b1fd
commit bd4ca22d03
6 changed files with 18 additions and 9 deletions

View File

@ -61,8 +61,6 @@ function M._create_parser(bufnr, lang, opts)
{ on_bytes = bytes_cb, on_detach = detach_cb, on_reload = reload_cb, preview = true }
)
self:parse(nil, function() end)
return self
end