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

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

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)

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

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
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants