aboutsummaryrefslogtreecommitdiff
path: root/test/functional/treesitter/parser_spec.lua
diff options
context:
space:
mode:
authorRiley Bruins <ribru17@hotmail.com>2024-12-20 16:23:52 -0800
committerRiley Bruins <ribru17@hotmail.com>2025-01-12 08:10:49 -0800
commitbd4ca22d0334a3323313dfd6975a80218ec65e36 (patch)
treee938b941b837bb0eec7516ade1bd6072b312927a /test/functional/treesitter/parser_spec.lua
parent45e606b1fddbfeee8fe28385b5371ca6f2fba71b (diff)
downloadrneovim-bd4ca22d0334a3323313dfd6975a80218ec65e36.tar.gz
rneovim-bd4ca22d0334a3323313dfd6975a80218ec65e36.tar.bz2
rneovim-bd4ca22d0334a3323313dfd6975a80218ec65e36.zip
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.
Diffstat (limited to 'test/functional/treesitter/parser_spec.lua')
-rw-r--r--test/functional/treesitter/parser_spec.lua12
1 files changed, 7 insertions, 5 deletions
diff --git a/test/functional/treesitter/parser_spec.lua b/test/functional/treesitter/parser_spec.lua
index 6f9faddbe3..825c2b8f29 100644
--- a/test/functional/treesitter/parser_spec.lua
+++ b/test/functional/treesitter/parser_spec.lua
@@ -1142,11 +1142,13 @@ print()
feed(':set ft=help<cr>')
exec_lua(function()
- vim.treesitter.get_parser(0, 'vimdoc', {
- injections = {
- vimdoc = '((codeblock (language) @injection.language (code) @injection.content) (#set! injection.include-children))',
- },
- })
+ vim.treesitter
+ .get_parser(0, 'vimdoc', {
+ injections = {
+ vimdoc = '((codeblock (language) @injection.language (code) @injection.content) (#set! injection.include-children))',
+ },
+ })
+ :parse()
end)
end)