[Python] Tweak keyword scopes#4576
Conversation
This commit assigns `async` the scope of the keyword it modifies. Basically `async def`, `async with` and `async for` are async variants of ordinary declaration or control keywords. Hence `storage.modifier` may not be the most appropriate choice for the latter two. The declaration, which `storage.modifier` is intended for already uses `keyword.declaration`. Finally highlighting of async keyword looks a bit off due to current scope in Mariana color scheme and maybe others which target basic scopes, only. This commit therefore attempts to align scope of `async` with the control keyword it belongs to, with a dedicated sub-scope for those who want to highlight it special.
|
I support change 1. I am ambivalent about change 2. |
|
In general I prefer dedicated scopes for single keywords as well. I also dislike how An alternative solution may be to just consume both I stumbled over both of Alternatives wellcome. |
|
I didn't notice in your first screenshots that you're matching the Is there a scope name that could cover the I guess I'm okay with this change and and RFC to talk about async more generally.
I am interested in this idea. |
|
There are no dedicated async scopes. The only thing I found was in JavaScript async functions, which was applied to I am tempted to just treat them as ordinary keyword.control same as their synchrounous counter parts. |
|
Ultimately, from an algorithmic pov it does not matter whether the In that sense, |
This PR...
withkeyword.control.context.withasflowmay be dedicated toreturn,continue, ... .asyncas part of corresponding control keyword to ensure consistent highlighting in default and basic color schemes. (For details, please refer to commit message).Before:
After: