atom / language-python

Python package for Atom
Other
190 stars 146 forks source link

Tokenize formal function parameters in tree-sitter grammar #297

Closed caleb531 closed 5 years ago

caleb531 commented 5 years ago

Requirements

Description of the Change

This PR tokenizes the formal function parameters in the tree-sitter grammar:

Before:

Screen Shot 2019-04-06 at 1 37 55 PM

After:

Screen Shot 2019-04-06 at 1 38 22 PM

Alternate Designs

I don't know if the core Atom team would prefer to use a different scope to tokenize these formal function parameters. However, the variable.parameter.function scope is already used to tokenize keyword arguments in the tree-sitter grammar, so I don't think there's any inconsistency here.

Benefits

Better highlighting for the formal function parameters in Python files matched by the tree-sitter grammar. This matches the highlighting in the existing first-mate grammar.

Possible Drawbacks

None that I can see.

Applicable Issues

N/A

nathansobo commented 5 years ago

:heart:

caleb531 commented 5 years ago

@nathansobo Wonderful! Any chance these changes will make it into the upcoming Atom v1.37? I only ask because I think it would be fitting complement to my recently-merged #296, which enables the tree-sitter parser more fully for Python files.

50Wliu commented 5 years ago

@caleb531 We're probably going to want this to go through the entire release cycle to identify any regressions before it reaches stable.

Arcanemagus commented 5 years ago

If you absolutely can't wait it should be available in the nightly builds, but note that that channel has zero manual testing on it and things may break at any time as it's built directly from Atom's master branch.

caleb531 commented 5 years ago

@50Wliu @Arcanemagus I myself can totally wait—I already have these changes in my init file anyway (thanks to SyntaxScopeMap's addSelector method). I was just thinking about other Atom users who may want the fullest of syntax highlighting sooner, but your reasoning and process make perfect sense, and I respect that.