-
Notifications
You must be signed in to change notification settings - Fork 33
chore(style,grammar): remove indirection for punctuation #236
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
chore(style,grammar): remove indirection for punctuation #236
Conversation
|
I'm cool with this change, should we ask for the opinion of the original author? |
|
I'm good with it. Is the CI broke due to the npm thing or something else? |
|
I can do a follow up doing the same with brackets and other glyphs, this PR was to test the waters. |
It's the NPM thing :\ https://github.com/nushell/tree-sitter-nu/actions/runs/19937120301/job/57165001540?pr=236#step:5:861: https://github.com/nushell/tree-sitter-nu/actions/runs/19937120301/job/57165001540?pr=236#step:5:861 EDIT: I can do the patch here before merge @fdncred |
|
@fdncred should be ready for re-review |
| const func = immediate ? token.immediate : token; | ||
| const excluded = '\\[\\]\\-{}<>="`\'@?,:.'; |
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.
@blindFS @fdncred Just want to call out that these kind of const declarations are a tree-sitter DSL antipattern.
These decls bypass a lot of potential optimizations by inlining where it's not needed.
EDIT: that may only apply to extras 🤔
blindFS
left a comment
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.
LGTM!
|
Thanks |
Most tree-sitter styles do not use indirection for anonymous nodes as it impacts readability:
https://github.com/tree-sitter/tree-sitter-rust/blob/261b20226c04ef601adbdf185a800512a5f66291/grammar.js#L249-L262
This PR is a style proposal so discussion is welcome/expected