Categorize async
Python keyword as a primary keyword when used in function declaration
#210
Labels
enhancement
New feature or request
Describe the need of your request
First off, I love this plugin, and it's the first plugin I install when setting up any JetBrains IDE. Thank you for building and maintaining it!
I have noticed that the
async
Python keyword is not properly themed when it is followed by thedef
keyword to match VSCode. With this theme enabled in PyCharm, theasync
keyword is always categorized and themed as a secondary keyword. By contrast, in VSCode, theasync
keyword is themed as a primary keyword if it is followed bydef
as part of a function declaration but themed as a secondary keyword everywhere else. Below are screenshots showing this.VSCode
PyCharm
It would be cool if the categorization of the
async
keyword could be conditional based on how it's used.Proposed solution
Since secondary keyword categorization and color assignment is handled by an annotator that extends the
BaseAnnotator
class, it is possible to get a given element's next sibling inside of thegetKeywordType
method. This allows for the primary vs secondary keyword categorization for theasync
keyword based on if theasync
keyword's next sibling is adef
keyword.I have already tested the bellow code and it works! I have added a screenshot to demonstrate this:
Note that the
async
keyword is now categorized and colored as a primary keyword when followed by adef
keyword, but when theasync
keyword is followed by any other keyword it is categorized and colored as a secondary keyword`Alternatives you've considered
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: