Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upColorize arrow function parameters without parens #652
Conversation
|
Thanks again @caleb531, someone will take a look as soon as they can |
|
Failure looks unrelated, we restarted it but same error. |
|
Note: All of the examples below are using Atom 1.42.0-nightly1 and the monokai syntax theme. With Tree-Sitter parsers disabledWith Tree-Sitter parsers enabledWith Tree-Sitter parsers enabled using the changes from this pull requestI see that the |
|
@jasonrudolph Ha, that's because it turns out I have the following styles in my atom-text-editor:not([mini]) .syntax--source.syntax--js .syntax--formal-parameter.syntax--identifier {
color: @orange;
}My apologies about that. But I agree, |
@caleb531: Cool. Wanna make that change? |
jasonrudolph
mentioned this pull request
|
@jasonrudolph Just pushed the rebased changes! The scope is now |
Thanks, @caleb531! |
jasonrudolph
mentioned this pull request





caleb531 commentedJul 16, 2019
Requirements
Description of the Change
This PR tokenizes single (paren-less) parameters for arrow functions. The first-mate source.js grammar already did this, while the current tree-sitter grammar does not. Consider the following screenshots:
Current tree-sitter grammar:

Tree-sitter grammar with this PR applied:

Current first-mate grammar:

Alternate Designs
A different selector could be used or the precedence of the grammar rule could be adjusted, if need be. Although this seems to work without any repercussions.
Benefits
More consistent coloring for arrow function parameters, whether or not you use parens.
Possible Drawbacks
I suppose if the selector chosen tokenizes more than it should, but I tried to keep it simple enough that it shouldn't be a concern.
Applicable Issues
N/A