You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
I expected @parameter.inner/outer to only select parameters, but it seems like it currently way too broad. This happens in rust, js, ts & go. Since this is the exact same behaviour this might be intended, if so why?
I couldn't really find any discussions on what should be counted as parameters and not so thought i would make an issue on it.
In my mind atleast, it would only make sense to only grab actual parameters, the way it's currently setup feels way to broad.
To Reproduce
Rust example:
fnmain(){let y = plus_one(5);// 5 is captured by @parameterprintln!("The value of y is: {y}");// Captured by @parameter}fnplus_one(y:i32) -> i32{// this is the only parameter in our code, & is captured by @parameter
y + 1}
Ts example:
// In this example every single line is captured by the @parameter capture groupfunctiontest(number: number){// number is the only actual parameter here.console.log("print number",number)console.log("not a parameter")}test(1)
This also happens in ts & go.
Expected behavior
In my own config i ended up basically using something like this:
Output of :checkhealth nvim-treesitter
nvim-treesitter: require("nvim-treesitter.health").check()
Installation ~
- OK `tree-sitter` found 0.24.3 (bdfe32402e85673bbc693216f0a6ef72c98bb665) (parser generator, only needed for :TSInstallFromGrammar)
- OK `node` found v22.9.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) 14.2.1 20240910
- 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 = "6.11.1-arch1-1",
sysname = "Linux",
version = "#1 SMP PREEMPT_DYNAMIC Mon, 30 Sep 2024 23:49:50 +0000"
} ~
Parser/Features H L F I J
- bash ✓ ✓ ✓ . ✓
- c ✓ ✓ ✓ ✓ ✓
- css ✓ . ✓ ✓ ✓
- html ✓ ✓ ✓ ✓ ✓
- javascript ✓ ✓ ✓ ✓ ✓
- lua ✓ ✓ ✓ ✓ ✓
- markdown ✓ . ✓ ✓ ✓
- markdown_inline ✓ . . . ✓
- python ✓ ✓ ✓ ✓ ✓
- query ✓ ✓ ✓ ✓ ✓
- rust ✓ ✓ ✓ ✓ ✓
- svelte ✓ ✓ ✓ ✓ ✓
- typescript ✓ ✓ ✓ ✓ ✓
- vim ✓ ✓ ✓ . ✓
- vimdoc ✓ . . . ✓
- vue ✓ . ✓ ✓ ✓
Legend: H[ighlight], L[ocals], F[olds], I[ndents], In[j]ections
+) multiple parsers found, only one will be used
x) errors found in the query, try to run :TSUpdate {lang} ~
Output of nvim --version
NVIM v0.10.2
Build type: RelWithDebInfo
LuaJIT 2.1.1727870382
Run "nvim -V1 -v"for more info
Additional context
Would a PR making @parameters.inner / outer more strict be welcome?
The text was updated successfully, but these errors were encountered:
arguments and parameters are both captured as @parameter. There is no separate builtin capture group for argument.
Parameters and arguments are somewhat related, but it would in my mind be more sensible to add a new capture group called arguments and separate those two. I have done this in my personal setup and it makes editing and jumping to those objects much faster and intuitive.
Describe the bug
I expected @parameter.inner/outer to only select parameters, but it seems like it currently way too broad. This happens in rust, js, ts & go. Since this is the exact same behaviour this might be intended, if so why?
I couldn't really find any discussions on what should be counted as parameters and not so thought i would make an issue on it.
In my mind atleast, it would only make sense to only grab actual parameters, the way it's currently setup feels way to broad.
To Reproduce
Rust example:
Ts example:
This also happens in ts & go.
Expected behavior
In my own config i ended up basically using something like this:
Output of
:checkhealth nvim-treesitter
Output of
nvim --version
Additional context
Would a PR making @parameters.inner / outer more strict be welcome?
The text was updated successfully, but these errors were encountered: