nvim-treesitter / nvim-treesitter/nvim-treesitter-textobjects
How to target the object and include the before text?
Nobody has claimed this yet.
- Dominant language
- Tree-sitter Query
- Stars
- 2.8k
- Forks
- 271
- Avg merge
- 8d 8h
- Merged PRs (30d)
- 1
Description
For example, in jsx, the each attribute of element are split by <space>.
But Treesitter doesn't include the separator(space).
When I delete this textobj(test={true}), the `' before is still there.
This is correct, but it is inconvenient.
Then I need to delete that space manually.
So, is there any to target the attribute, but also include the space(one or more) before?
and here's my config now.
; jsx attributes
(jsx_self_closing_element attribute: (_) @attribute.outer)
(jsx_element open_tag: (_ attribute: (_) @attribute.outer))
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 from the JSX attribute query patterns shown in the issue and inspect how captured @attribute.outer nodes are turned into text-object ranges. Check how preceding whitespace is handled for deletion, then verify the behavior on the JSX examples described in the issue. Done means targeting an attribute can include its preceding space without requiring a separate deletion.
Written by the indexing model from the issue text.
Assessment
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100