| Commit message (Collapse) | Author | Age |
|
|
|
|
| |
Breaking change: `ts_node_child_containing_descendant()` was removed
Breaking change: tree-sitter 0.25 (HEAD) required
|
|
|
|
|
|
|
|
|
|
| |
**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 also marks `child_containing_descendant()` as deprecated
(per upstream's documentation), and uses `child_with_descendant()` in
its place. Minimum required tree-sitter version will now be `0.24`.
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
Problem:
Tests have lots of exec_lua calls which input blocks of code
provided as unformatted strings.
Solution:
Teach exec_lua how to handle functions.
|
|
|
|
|
| |
Adds a new field `include_anonymous` to the `get_node` options to allow
anonymous nodes to be returned.
|
|
|
|
|
|
|
|
|
| |
Problem: `has-ancestor?` is O(n²) for the depth of the tree since it iterates over each of the node's ancestors (bottom-up), and each ancestor takes O(n) time.
This happens because tree-sitter's nodes don't store their parent nodes, and the tree is searched (top-down) each time a new parent is requested.
Solution: Make use of new `ts_node_child_containing_descendant()` in tree-sitter v0.22.6 (which is now the minimum required version) to rewrite the `has-ancestor?` predicate in C to become O(n).
For a sample file, decreases the time taken by `has-ancestor?` from 360ms to 6ms.
|
|
|
|
|
|
|
|
|
| |
Specifically, functions that are run in the context of the test runner
are put in module `test/testutil.lua` while the functions that are run
in the context of the test session are put in
`test/functional/testnvim.lua`.
Closes https://github.com/neovim/neovim/issues/27004.
|
| |
|
|
|
|
| |
Work on https://github.com/neovim/neovim/issues/27004.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
| |
correctly takes opts.lang (#26360)
PROBLEM: `vim.treesitter.get_node()` does not recognize the `lang` in
the option table. This option was used in somewhere else, for instance,
`vim.treesitter.dev` (for `inspect_tree`) but was never implemented.
SOLUTION: Make `get_node()` correctly use `opts.lang` when getting a
treesitter parser.
|
|
|
|
|
|
|
| |
Unfortunately the gc=false objects can refer to a dangling tree if the
gc=true tree was freed first. This reuses the same tree object as the
node itself is keeping alive via the uservalue of the node userdata.
(wrapped in a table due to lua 5.1 restrictions)
|
|
|
|
|
|
|
|
|
| |
Problem: `push_tree`, every time its called for the same TSTree with
`do_copy=false` argument, creates a new userdata for it. Each userdata,
when garbage collected, frees the same TSTree C object.
Solution: Add flag to userdata, which indicates, should C object,
which userdata points to, be freed, when userdata is garbage collected.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The following top level Treesitter functions have been moved:
- vim.treesitter.inspect_language() -> vim.treesitter.language.inspect()
- vim.treesitter.get_query_files() -> vim.treesitter.query.get_files()
- vim.treesitter.set_query() -> vim.treesitter.query.set()
- vim.treesitter.query.set_query() -> vim.treesitter.query.set()
- vim.treesitter.get_query() -> vim.treesitter.query.get()
- vim.treesitter.query.get_query() -> vim.treesitter.query.get()
- vim.treesitter.parse_query() -> vim.treesitter.query.parse()
- vim.treesitter.query.parse_query() -> vim.treesitter.query.parse()
- vim.treesitter.add_predicate() -> vim.treesitter.query.add_predicate()
- vim.treesitter.add_directive() -> vim.treesitter.query.add_directive()
- vim.treesitter.list_predicates() -> vim.treesitter.query.list_predicates()
- vim.treesitter.list_directives() -> vim.treesitter.query.list_directives()
- vim.treesitter.query.get_range() -> vim.treesitter.get_range()
- vim.treesitter.query.get_node_text() -> vim.treesitter.get_node_text()
|
|
|
|
|
| |
Treesitter parsers are now a mandatory part of the installation and
should be tested on all platforms. Remove `pending_c_parser` helper.
|
|
|
|
| |
Util from the nvim-treesitter project.
|
|
|
|
| |
Util from the nvim-treesitter project.
|
|
|
|
| |
Util from the nvim-treesitter project.
|
|
Add tsnode methods to change to the next, previous, named or unnamed
nodes.
|