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 1 commit into from May 24, 2019


Copy link

@caleb531 caleb531 commented May 12, 2019


  • 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.




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)

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
Copy link

@jasonrudolph jasonrudolph 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:



Tree-sitter before this PR


Tree-sitter after this PR


@jasonrudolph jasonrudolph merged commit 310c4aa into atom:master May 24, 2019
2 checks passed
2 checks passed
continuous-integration/appveyor/pr AppVeyor build succeeded
continuous-integration/travis-ci/pr The Travis CI build passed
@50Wliu 50Wliu mentioned this pull request Jun 17, 2019
1 task done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants