Add special cases for UPPERCASE classes in GDScript syntax-coloring (JSON
, UPNP
, etc); and color super
as a keyword
#767
Labels
JSON
, UPNP
, etc); and color super
as a keyword
#767
Godot version
4.3.stable
VS Code version
1.96.0 codium snap
Godot Tools VS Code extension version
2.3.0
System information
Ubuntu 24.04
Issue description
Opening an issue for the suggestion here #739 (comment) so it's not forgotten, as @DaelonSuzuka seems to agree.
It seems GDScript doesn't currently support semantic coloring, so it uses certain heuristics, like coloring UPPERCASE identifiers as constants. This is good enough for the majority of cases, but there's a few exceptions in Godot built-in classes that are somewhat easy to track.
These classes are known to be using UPPERCASE-only identifiers, exceptionally:
JSON
(constructible with new)UPNP
(constructible with new)OS
IP
JSONRPC
XRVRS
Since it's a very small list, it's easy to add them to
GDScript.tmLanguage.json
underpascal_case_class
as exceptions, so they are matched as classes rather than constants. All 6 above should be added. If not, at least the first 2, which are constructible with new, and so it's extra weird to color them as constants.godot-vscode-plugin/syntaxes/GDScript.tmLanguage.json
Lines 447 to 450 in 2e91178
Also, please move
super
away frombuiltin_classes
, as it's a keyword, not a class.It can be called like
super(arg1, arg2)
as well assuper.my_base_method(etc)
, and both of these semantics are different from a class, specially from a basic Variant type.If even
void
is a keyword, thensuper
should surely not be a type.More importantly, it raises an error when used as an identifier, unlike built-in class names. So it's a keyword.
godot-vscode-plugin/syntaxes/GDScript.tmLanguage.json
Lines 439 to 442 in 2e91178
Steps to reproduce
The text was updated successfully, but these errors were encountered: