nvim-treesitter / nvim-treesitter/nvim-treesitter-textobjects
Parameter.outer grabs too much in Ruby
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
I have this code and with the cursor on the b in abc I execute the function:
This is what is selected:
Expected behavior
I would expect abc, to be selected instead of all the parameters.
Output of :checkhealth nvim-treesitter
nvim-treesitter: require("nvim-treesitter.health").check()
Installation ~
- WARNING
tree-sitter executable not found (parser generator, only needed for :TSInstallFromGrammar, not required for :TSInstall)
- OK
node found v20.7.0 (only needed for :TSInstallFromGrammar)
- OK
git executable found.
- OK
cc executable found. Selected from { vim.NIL, "cc", "gcc", "clang", "cl", "zig" }
Version: cc (GCC) 13.2.1 20230801
- OK Neovim was compiled with tree-sitter runtime ABI version 14 (required >=13). Parsers must be compatible with runtime ABI.
OS Info:
{
machine = "x86_64",
release = "5.15.90.1-microsoft-standard-WSL2",
sysname = "Linux",
version = "#1 SMP Fri Jan 27 02:56:13 UTC 2023"
} ~
Parser/Features H L F I J
- bash ✓ ✓ ✓ . ✓
- c ✓ ✓ ✓ ✓ ✓
- eex ✓ . . . ✓
- elixir ✓ ✓ ✓ ✓ ✓
- elm ✓ . . . ✓
- heex ✓ ✓ ✓ ✓ ✓
- json ✓ ✓ ✓ ✓ .
- kdl ✓ ✓ ✓ ✓ ✓
- lua ✓ ✓ ✓ ✓ ✓
- make ✓ . ✓ . ✓
- markdown ✓ . ✓ ✓ ✓
- query ✓ ✓ ✓ ✓ ✓
- ruby ✓ ✓ ✓ ✓ ✓
- vim ✓ ✓ ✓ . ✓
- vimdoc ✓ . . . ✓
- yaml ✓ ✓ ✓ ✓ ✓
Output of nvim --version
NVIM v0.9.2
Build type: Release
LuaJIT 2.1.1694285958
system vimrc file: "$VIM/sysinit.vim"
fall-back for $VIM: "/usr/share/nvim"
Additional context
I've disabled all plugins except for nvim-treesitter/nvim-treesitter and nvim-treesitter/nvimtreesitter-textobjects.
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 reported Parameter.outer selection using the Ruby example and inspect the plugin's textobject query or configuration for Ruby parameters. Confirm the selection boundaries, then verify that the same cursor position selects only abc, rather than all parameters.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ruby
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100