nvim-treesitter / nvim-treesitter/nvim-treesitter-textobjects
Weird behavior for @block.* in some languages
Nobody has claimed this yet.
- Dominant language
- Tree-sitter Query
- Stars
- 2.8k
- Forks
- 271
- Avg merge
- 8d 8h
- Merged PRs (30d)
- 1
Description
Describe the bug
The queries for @block.inner and @block.outer are very unituitive and not all that useful to me, at least for rust and ecma script. As an example: this is selected with @block.inner:
So basically the outer block. Instead I would expect something like that to be selected
To Reproduce
Steps to reproduce the behavior:
Use the @block.* text objects
Expected behavior
The content inside the block is selected for @block.inner or the block itself for @block.outer
Output of :checkhealth nvim-treesitter
N/A
Output of nvim --version
N/A
Additional context
I created a PR here that fixes it in rust and ecma script, if this behavior is noticed in other languages as well I can try and add those as well. For lua it works well, so maybe not a general problem
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the proposed fix in PR #796 and compare the @block.inner and @block.outer queries for Rust and ECMAScript with Lua’s working behavior. Check whether other language queries show the same selection problem and verify the expected inner and outer selections before extending the fix.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, rust
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100