You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think the python grammar should have more support for types, both type annotations, and type comments (or not since that's worth less now). Ironically there's more info for type comments than annotations currently.
Which I think is mostly there, but I wish the arrow was part of the directive.notation, just like the colon is in type:.
For the type ignore:
# type: ignore[attr-defined]
| | | |- (the dash is no longer a comment.typehint.* !)
| | |- comment.typehint.variable.notation.python
| |- comment.typehint.variable.notation.python
|- comment.typehint.directive.notation.python
I think type: ignore should all be a directive. The argument inside should maybe be a new thing? Variable is kinda ok, but I think variable.error? or something additional suggesting it's an error argument would be nice. I do think it's weird the - in attr-defined loses the comment.typehint scope entirely, since it's all one label. If this were # type: ignore[attr-defined,call-arg] (two labels sep by comma), the comma is at least still a comment.typehint.punctuation.notation.python
For full type annotations:
|- constant.language.python
| |- punctuation.separator.annotation.result.python
async def x(arg1: Iterable[Class], arg2: Class | None) -> Class:
| | | | |- no more annotations!
| | | |- no more annotations!
| | |- meta.item-access.arguments.python meta.item-access.python
| |- meta.indexed-name.python meta.item-access.python
|- variable.parameter.function.language.python
(meta.function.parameters.python meta.function.python source.python) applies everywhere
There's really not much going on here tagging these as type related, and I wish there were. Things like Iterable[Class] and Class | None should have a type annotation scope of some kind, and same with the return type. I think -> has a good scope name, but the union seperator should also have a relevant scope that's more than just keyword.operator.bitwise.python
Ideally there should be more to go on for type annotations than type comments in python.
The text was updated successfully, but these errors were encountered:
I think the python grammar should have more support for types, both type annotations, and type comments (or not since that's worth less now). Ironically there's more info for type comments than annotations currently.
Currently there's the type comment:
Which I think is mostly there, but I wish the arrow was part of the
directive.notation
, just like the colon is intype:
.For the type ignore:
I think
type: ignore
should all be adirective
. The argument inside should maybe be a new thing? Variable is kinda ok, but I think variable.error? or something additional suggesting it's an error argument would be nice. I do think it's weird the-
inattr-defined
loses thecomment.typehint
scope entirely, since it's all one label. If this were# type: ignore[attr-defined,call-arg]
(two labels sep by comma), the comma is at least still acomment.typehint.punctuation.notation.python
For full type annotations:
There's really not much going on here tagging these as type related, and I wish there were. Things like
Iterable[Class]
andClass | None
should have a type annotation scope of some kind, and same with the return type. I think->
has a good scope name, but the union seperator should also have a relevant scope that's more than justkeyword.operator.bitwise.python
Ideally there should be more to go on for type annotations than type comments in python.
The text was updated successfully, but these errors were encountered: