Skip to content
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

Tokenize *args and **kwargs the same as other parameters (tree-sitter) #303

Merged
merged 1 commit into from May 24, 2019

Conversation

Projects
None yet
2 participants
@caleb531
Copy link
Contributor

commented May 12, 2019

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

Back in #297, I added highlighting for formal function parameters to the Python tree-sitter grammar. This PR follows up on that work with two additional fixes for splat parameters such as *args and **kwargs.

Alternate Designs

I could've chosen more-generic or more-specific selectors to tokenize these nodes, depending on how broad these changes are desired to be. But to avoid any potential breakages, I aimed to keep these changes narrow in scope.

Before:
Before

After:
After

Benefits

More consistent syntax highlighting for tree-sitter-tokenized Python files, continuing in the spirit of #297

Possible Drawbacks

I don't think there are any, as I tried to make my changes focused enough to avoid breaking anything. But if there's anything else I could consider in terms of the impact on Python syntax, please let me know!

Applicable Issues

#297 (already merged by @nathansobo)

Tokenize *args and **kwargs the same as other parameters
These changes are specifically for the Python tree-sitter grammar.

@caleb531 caleb531 changed the title Tokenize *args and **kwargs the same as other parameters Tokenize *args and **kwargs the same as other parameters (tree-sitter) May 12, 2019

@jasonrudolph jasonrudolph self-assigned this May 24, 2019

@jasonrudolph

This comment has been minimized.

Copy link
Member

commented May 24, 2019

Cool! Thanks, @caleb531. I also compared the syntax highlighting in this pull request to the syntax highlighting that the old TextMate grammar provides, and confirmed that this pull request brings the Tree-sitter syntax highlighting up to par with the TextMate syntax highlighting for *args and **kwargs:

TextMate

1-textmate

Tree-sitter before this PR

2-tree-sitter-before

Tree-sitter after this PR

3-tree-sitter-after

@jasonrudolph jasonrudolph merged commit 310c4aa into atom:master May 24, 2019

2 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@50Wliu 50Wliu referenced this pull request Jun 17, 2019

Closed

Atom 1.32 breaks syntax highlighting #281

1 of 1 task complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.