nvim-treesitter / nvim-treesitter/nvim-treesitter-textobjects
include_surrounding_whitespace should be an option on the mapping itself
Open
Nobody has claimed this yet.
enhancement
- Dominant language
- Tree-sitter Query
- Stars
- 2.8k
- Forks
- 271
- Avg merge
- 8d 8h
- Merged PRs (30d)
- 1
Description
Instead of requiring users to implement and write their own monolithic function themselves as in
keymaps = {
["af"] = "@function.outer",
["if"] = "@function.inner",
["aa"] = "@attribute.outer",
["ia"] = "@attribute.inner",
....
],
include_surrounding_whitespace = function (a)
if a.query_string == "@function.outer" then
return false
elseif a.query_string == "@function.inner" then
return false
elseif a.query_string == "@attribute.outer" then
return true
elseif a.query_string == "@attribute.inner" then
return false
....
end
I think making it an option on the keymap is a nicer and more expected API:
keymaps = {
["af"] = "@function.outer",
["if"] = "@function.inner",
["aa"] = { query = "@attribute.outer", includes_surrounding_whitespace = true },
["ia"] = "@attribute.inner",
....
],
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 locating the keymaps configuration and the existing include_surrounding_whitespace handling in the textobjects plugin. Check how current mapping values are interpreted, then verify that per-keymap settings can express the requested behavior without breaking existing mappings.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- lua, neovim
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100