Fix syntax highlighting for camelCase identifiers

Currently, any occurrences of PascalCase identifiers (even as parts of other words) are recognized as classes.
This assumes snake_case convention for all methods and variables and makes it impossible to use camelCase. While this is the recommended GDScript style, the syntax highlighter should allow for different styles as long as it can do so unambiguously. This is already done for existing rules, but overridden by one rule with an overly general regex pattern.

This commit modifies the catch-all rule for the 'parscal_class' group to only capture whole words.
For clarity, it renames 'parscal_class' to 'pascal_case_class'.

Other groups to recognize classes remain unchanged: type_declear, function-return-type, class_def, class_new, class_is, class_enum, class_name, extends
This commit is contained in:
Jan Haller
2019-12-29 17:10:50 +01:00
parent ca3a1e62c4
commit 555cb1ce9a

View File

@@ -27,7 +27,7 @@
{ "include": "#any-method" },
{ "include": "#any-property" },
{ "include": "#extends" },
{ "include": "#parscal_class" }
{ "include": "#pascal_case_class" }
],
"repository": {
"comment": {
@@ -328,11 +328,11 @@
}
]
},
"parscal_class": {
"pascal_case_class": {
"captures": {
"1": { "name": "entity.name.type.class.gdscript" }
},
"match": "([A-Z][a-zA-Z_0-9]*)"
"match": "\\b([A-Z][a-zA-Z_0-9]*)\\b"
}
}
}