nvim-treesitter / nvim-treesitter/nvim-treesitter-textobjects
FR: `include_surrounding_whitespace` should adjust whitespace characters included based on mode
Nobody has claimed this yet.
- Dominant language
- Tree-sitter Query
- Stars
- 2.8k
- Forks
- 271
- Avg merge
- 8d 8h
- Merged PRs (30d)
- 1
Description
Is your feature request related to a problem? Please describe.
Enabling include_surrounding_whitespace often leads to technically correct, but somewhat unexpected behavior.
Given this text:
local obj = {
text = "foobar", -- comment
number = 123,
}
For instance, deleting the --comment via @comment.outer results in:
local obj = {
text = "foobar", number = 123,
}
Which is technically correct – surrounding whitespace was included – but very unintuitive behavior.
Describe the solution you'd like
include_surrounding_whitespace should not include line breaks if the text object is characterwise.
Describe alternatives you've considered
Simply disabling include_surrounding_whitespace entirely (which is a waste, since it's in principle a nice feature)
Additional context
There are a few other issues like #575 which seem to be related to this 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
Reproduce the Lua example with include_surrounding_whitespace enabled and inspect the text-object handling that determines which surrounding characters are included. Done means characterwise text objects exclude line breaks while preserving the intended surrounding whitespace behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- lua, neovim
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100