mirror of
https://github.com/neovim/neovim.git
synced 2025-10-26 12:27:24 +00:00
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:
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user