nvim-treesitter / nvim-treesitter/nvim-treesitter-textobjects
Smart selection 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.
It would be nice if we could have "smart" selection mode, i.e., if the textobject takes up whole line/lines, use line-wise select, else use char-wise select. E.g., for the following lua function, use line-wise select:
local function my_func()
return
end
But for this function, use char-wise select, as it does not take up a whole line at the beginning of the function:
local my_func = function()
return
end
Describe the solution you'd like
Smartly detect if a textobj should have line-wise selection or char-wise selection based on its range.
Describe alternatives you've considered
N/A
Additional context
N/A
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
No file or test is named in the issue. Start by locating the textobject selection entry point and the code that computes its range; then compare the line-wise and character-wise selection behavior in the two Lua examples. Done means the selection mode is chosen from whether the range occupies whole lines, with both examples covered by tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- lua
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100