To strictly follow original TextMate scope naming guidelines any kind of user (or (standard) library) defined entity (types, classes, constants, …) would need to be scoped support. ...
. So support.class
would be the scope to choose in general.
The reason for storage.type.class
being used in Java is the ST specific interpretation of support.
to be dedicated for entities of a language’s “standard library” only. As Java doesn’t maintain lists of all built-ins, a more general support
-unrelated scope was choosen.
While Java implements sophisticated expression specific strategies to match data types as accurate as possible (without relying on casing), that’s not feasable in most other syntaxes.
While it is quite obvious MyClass
to be a class when following isinstanceof
, it may not be so clear in any other expression. Static class access expressions can be located at the same position where normal variables are allowed. Hence casing was probably the only heuristic which can be applied - as already stated.
Relying on casing has been one of the most popular reasons for bug reports of Java syntax for instance. Hence it’s probably better to apply a generic scope only, because it would look broken to scope the same token different depending on location or context. A static syntax engine just can’t provide more detailed semantic scopes.
Python is such a syntax, too. We just can’t scope tokens semantically due to several ambiguities. So scoping classes support.class
is usefull only for well known classes. So Union
or Set
or types like that might be scoped support.class
, but it’s not useful for user defined types - neither in type comments nor elsewhere.