Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.

Colorize rest parameters like other formal parameters #654

Merged
merged 3 commits into from
Sep 5, 2019

Conversation

caleb531
Copy link
Contributor

Requirements

  • Filling out the template is required. Any pull request that does not include enough information to be reviewed in a timely manner may be closed at the maintainers' discretion.
  • All new code requires tests to ensure against regressions

Description of the Change

Currently, the tree-sitter grammar does not colorize rest parameters in functions. This is in contrast to the first-mate grammar, which does colorize such parameters. This PR colorizes rest parameters as formal-parameter.identifier, like other function parameters.

Before:
1-before

After (with these PR changes):
2-after

Current first-mate grammar:
3-firstmate

Alternate Designs

The selector was chosen because it is similar to the existing selector for formal parameters, so it should have no conflicts with other grammar rules.

Benefits

Rest parameters are now treated just like other formal function parameters.

Possible Drawbacks

None that I can see, since the grammar rule's selector is limited in scope.

Applicable Issues

N/A

@rsese rsese added the triaged label Jul 18, 2019
@rsese
Copy link

rsese commented Jul 18, 2019

Failure looks unrelated, we restarted it but same error.

@jasonrudolph
Copy link
Contributor

@caleb531: Similar to #652 (comment), I think we may want to use the scope names that the TextMate grammar uses. What do you think?

Scopes assigned using TextMate

Screen Shot 2019-08-16 at 9 08 04 AM

Scopes assigned using Tree-sitter grammar on this branch

Screen Shot 2019-08-16 at 9 07 44 AM

@caleb531 caleb531 force-pushed the rest-parameter-color branch from cf96aa1 to e748023 Compare August 17, 2019 02:30
@caleb531
Copy link
Contributor Author

@jasonrudolph Done! The scope is now variable.parameter.function.

@jasonrudolph
Copy link
Contributor

Thanks for this, @caleb531! ⚡🙇

@jasonrudolph jasonrudolph merged commit 7c9b5a9 into atom:master Sep 5, 2019
@jasonrudolph jasonrudolph self-assigned this Sep 5, 2019
@caleb531 caleb531 deleted the rest-parameter-color branch September 5, 2019 16:40
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants