Align the way rust and typescript are defining field paramaters
Is your feature request related to a problem? Please describe. Seeing the PR https://github.com/nvim-treesitter/nvim-treesitter-textobjects/pull/751 made me think that it would be possible to resolve the problem I am struggling with for quite some time.
In rust
let value = MyStruct {
my_param: 13
};
If I want to work with my_param I need to use @parameter text object, but in typescript with the exact same code
let value = MyStruct {
my_param: 13
}
I have to use @variable for whatever reason
Describe the solution you'd like Have similar code in different languages to be handled in the similar way either @parameter or @attribute in both cases
Describe alternatives you've considered to suffer
So in Typescript, an object is often used for function parameters. But I think in Rust it's not the case because of efficiency.
Currently, for the sake of simplicity the @parameter should select an entire parameter and there's no distinction between the @parameter.name and @parameter.value (some languages don't even support named arguments).
@variable is not part of this plugin and I believe it's a highlighting definition from nvim-treesitter. The purpose of highlighting queries is not for textobjects so we can't guarantee the alignment of it across languages.
TL;DR
@parameter.nameis not supported in the plugin yet. So what you want to do can't be done without custom queries or queries from another plugin.- If we want to align
@parameter.innerand@parameter.outer, then the Rust behaviour has to change to match Typescript. Typescript one is correct.
You mean the parse itself?
parsing is done by treesitter which and the grammar supports it. But we don't have a query to select just parameter names