generated from nvim-treesitter/module-template
-
Notifications
You must be signed in to change notification settings - Fork 202
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make parameter.outer delete the preceeding comma in python, dart, rust, c/c++, and some other changes #87
Merged
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
1d7ce5c
Splitting parameter into two cases such that it is possible to distin…
Jacfger 909782a
Last parameter has to have bracket
Jacfger b7150e6
Revert "Last parameter has to have bracket"
Jacfger 53631b6
Testing
Jacfger 239e614
Adding list and tuple support
Jacfger 9045463
parameter.outer is now defined from the previous comma to the end of …
Jacfger 2c26215
Dictionary also added but why wouldn't just delete the whole you
Jacfger 4afda20
do c/c++, dart and rust
IndianBoy42 d8f94f9
Fixing if there is only one argument, also I thought argument_list wa…
Jacfger 8ae5efe
Adding the same fix to the c/c++
Jacfger d570f2c
Fix single parameter list handling
IndianBoy42 0f63268
Fix formatting
IndianBoy42 3995ede
Update README.md
IndianBoy42 8e03f82
make dart queries compile again
IndianBoy42 4ed82ad
extend rust @parameter textobjects
IndianBoy42 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can write the
@parameter.inner
in another query, so we don't have duplicates and they also match functions with one parameter. Same for the other queries.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is possible, although I found another way to fix single parameter lists. If we do extract parameter.inner to a separate query then that would essentially be three queries for every kind of parameter. having 2 already feels unnecessary but I dont know how to do it more elegantly
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think having three queries is more explicit, and we don't have to worry about always trying to capture the inner parameter, and that's one less query for treesitter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We always have to capture the @parameter.inner symbol as part of constructing the @parameter.outer range anwyay. (unless there is a way to do this more directly that I am not familiar with?)
It would just be
s/@parameter.inner/@_par
and adding a third query for the parameter inner.If there are performance implications it would be interesting to check, is there anyway to benchmark this?
Single parameter lists are fixed anyway
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, that's more explicit and would avoid bugs when changing those queries, like the one that was included.
Don't know how to benchmark, but I think these would just generate two matches for
parameter.inner
instead of just one.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i see how it would be more explicit but I don't see how it would avoid bugs? if you wanted to change which nodes are parameters you would have to change 3 places most likely, (right now you have to change two places which is not great either)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but you won't need to worry about changing or breaking
parameter.inner
, that one would always work, the other queries will only need to change@_end
or@_start
forparameter.outer