mirror of
https://github.com/godotengine/godot-vscode-plugin.git
synced 2026-01-04 10:09:58 +03:00
Fix incorrect highlighting in dictionary literals (#419)
This commit is contained in:
@@ -48,16 +48,10 @@
|
||||
"include": "#self"
|
||||
},
|
||||
{
|
||||
"include": "#const_def"
|
||||
"include": "#class_definition"
|
||||
},
|
||||
{
|
||||
"include": "#class_def"
|
||||
},
|
||||
{
|
||||
"include": "#var_def"
|
||||
},
|
||||
{
|
||||
"include": "#type_hint"
|
||||
"include": "#variable_definition"
|
||||
},
|
||||
{
|
||||
"include": "#class_name"
|
||||
@@ -65,9 +59,6 @@
|
||||
{
|
||||
"include": "#builtin_func"
|
||||
},
|
||||
{
|
||||
"include": "#node_path"
|
||||
},
|
||||
{
|
||||
"include": "#builtin_get_node_shorthand"
|
||||
},
|
||||
@@ -90,22 +81,22 @@
|
||||
"include": "#class_enum"
|
||||
},
|
||||
{
|
||||
"include": "#signal-declaration-bare"
|
||||
"include": "#signal_declaration_bare"
|
||||
},
|
||||
{
|
||||
"include": "#signal-declaration"
|
||||
"include": "#signal_declaration"
|
||||
},
|
||||
{
|
||||
"include": "#function-declaration"
|
||||
"include": "#function_declaration"
|
||||
},
|
||||
{
|
||||
"include": "#function_keyword"
|
||||
},
|
||||
{
|
||||
"include": "#any-method"
|
||||
"include": "#any_method"
|
||||
},
|
||||
{
|
||||
"include": "#any-property"
|
||||
"include": "#any_property"
|
||||
},
|
||||
{
|
||||
"include": "#extends"
|
||||
@@ -257,7 +248,7 @@
|
||||
"include": "#control_flow"
|
||||
},
|
||||
{
|
||||
"include": "#function-call"
|
||||
"include": "#function_call"
|
||||
},
|
||||
{
|
||||
"include": "#comment"
|
||||
@@ -284,7 +275,7 @@
|
||||
"include": "#pascal_case_class"
|
||||
},
|
||||
{
|
||||
"include": "#line-continuation"
|
||||
"include": "#line_continuation"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -321,7 +312,7 @@
|
||||
"name": "keyword.control.gdscript"
|
||||
},
|
||||
"keywords": {
|
||||
"match": "\\b(?i:class|class_name|extends|is|onready|tool|static|export|setget|const|as|void|enum|preload|assert|breakpoint|rpc|sync|remote|master|puppet|slave|remotesync|mastersync|puppetsync|trait|namespace)\\b",
|
||||
"match": "\\b(?i:class|class_name|extends|is|onready|tool|static|export|as|void|enum|preload|assert|breakpoint|rpc|sync|remote|master|puppet|slave|remotesync|mastersync|puppetsync|trait|namespace)\\b",
|
||||
"name": "keyword.language.gdscript"
|
||||
},
|
||||
"letter": {
|
||||
@@ -352,24 +343,51 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
"const_def": {
|
||||
"match": "\\b(?i:(const))\\s+([a-zA-Z_][a-zA-Z_0-9]*)",
|
||||
"captures": {
|
||||
"1": {
|
||||
"name": "storage.type.const.gdscript"
|
||||
},
|
||||
"2": {
|
||||
"name": "constant.language.gdscript"
|
||||
}
|
||||
}
|
||||
},
|
||||
"var_def": {
|
||||
"match": "\\b(?i:(var))\\s+(?=[a-zA-Z_][a-zA-Z_0-9]*)",
|
||||
"captures": {
|
||||
"variable_definition": {
|
||||
"begin": "\\b(?:(var)|(const))",
|
||||
"end": "$",
|
||||
"beginCaptures": {
|
||||
"1": {
|
||||
"name": "storage.type.var.gdscript"
|
||||
},
|
||||
"2": {
|
||||
"name": "storage.type.const.gdscript"
|
||||
}
|
||||
}
|
||||
},
|
||||
"patterns": [
|
||||
{
|
||||
"match": "(:)\\s*([\\w]*)?",
|
||||
"captures": {
|
||||
"1": {
|
||||
"name": "punctuation.separator.annotation.gdscript"
|
||||
},
|
||||
"2": {
|
||||
"name": "entity.name.type.class.gdscript"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"match": "=(?!=)",
|
||||
"name": "keyword.operator.assignment.gdscript"
|
||||
},
|
||||
{
|
||||
"match": "(setget)\\s+([\\w]*)(?:[,]\\s*([\\w]*))?",
|
||||
"captures": {
|
||||
"1": {
|
||||
"name": "storage.type.const.gdscript"
|
||||
},
|
||||
"2": {
|
||||
"name": "entity.name.function.gdscript"
|
||||
},
|
||||
"3": {
|
||||
"name": "entity.name.function.gdscript"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"include": "#base_expression"
|
||||
}
|
||||
]
|
||||
},
|
||||
"getter_setter_godot4": {
|
||||
"patterns": [
|
||||
@@ -395,7 +413,7 @@
|
||||
"include": "#parameters"
|
||||
},
|
||||
{
|
||||
"include": "#line-continuation"
|
||||
"include": "#line_continuation"
|
||||
},
|
||||
{
|
||||
"match": "\\s*(\\-\\>)\\s*([a-zA-Z_][a-zA-Z_0-9]*)\\s*\\:",
|
||||
@@ -410,15 +428,7 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
"type_hint": {
|
||||
"match": "\\:\\s*([a-zA-Z_][a-zA-Z_0-9]*)\\s*(?=[=\\n]|setget)",
|
||||
"captures": {
|
||||
"1": {
|
||||
"name": "entity.name.type.class.gdscript"
|
||||
}
|
||||
}
|
||||
},
|
||||
"class_def": {
|
||||
"class_definition": {
|
||||
"captures": {
|
||||
"1": {
|
||||
"name": "entity.name.type.class.gdscript"
|
||||
@@ -492,8 +502,8 @@
|
||||
]
|
||||
},
|
||||
"builtin_get_node_shorthand_quoted": {
|
||||
"begin": "(\\$)([\\\"\\'])",
|
||||
"end": "([\\\"\\'])",
|
||||
"begin": "(\\$)([\"'])",
|
||||
"end": "([\"'])|$",
|
||||
"name": "support.function.builtin.shorthand.gdscript",
|
||||
"beginCaptures": {
|
||||
"1": {
|
||||
@@ -551,7 +561,7 @@
|
||||
}
|
||||
},
|
||||
"builtin_classes": {
|
||||
"match": "(?<![^.]\\.|:)\\b(OS|Vector2|Vector2i|Vector3|Vector3i|Color|Rect2|Rect2i|Array|Basis|Dictionary|Plane|Quat|RID|Rect3|Transform|Transform2D|Transform3D|AABB|String|Color|NodePath|Object|PoolByteArray|PoolIntArray|PoolRealArray|PoolStringArray|PoolVector2Array|PoolVector3Array|PoolColorArray|bool|int|float|StringName|Quaternion|PackedByteArray|PackedInt32Array|PackedInt64Array|PackedFloat32Array|PackedFloat64Array|PackedStringArray|PackedVector2Array|PackedVector2iArray|PackedVector3Array|PackedVector3iArray|PackedColorArray|super)\\b",
|
||||
"match": "(?<![^.]\\.|:)\\b(OS|GDScript|Vector2|Vector2i|Vector3|Vector3i|Color|Rect2|Rect2i|Array|Basis|Dictionary|Plane|Quat|RID|Rect3|Transform|Transform2D|Transform3D|AABB|String|Color|NodePath|Object|PoolByteArray|PoolIntArray|PoolRealArray|PoolStringArray|PoolVector2Array|PoolVector3Array|PoolColorArray|bool|int|float|StringName|Quaternion|PackedByteArray|PackedInt32Array|PackedInt64Array|PackedFloat32Array|PackedFloat64Array|PackedStringArray|PackedVector2Array|PackedVector2iArray|PackedVector3Array|PackedVector3iArray|PackedColorArray|super)\\b",
|
||||
"name": "support.class.library.gdscript"
|
||||
},
|
||||
"const_vars": {
|
||||
@@ -562,7 +572,7 @@
|
||||
"match": "\\b([A-Z][a-z_0-9]*([A-Z]?[a-z_0-9]+)*[A-Z]?)\\b",
|
||||
"name": "support.class.library.gdscript"
|
||||
},
|
||||
"signal-declaration-bare": {
|
||||
"signal_declaration_bare": {
|
||||
"match": "(?x) \\s*\n (signal) \\s+\n ([a-zA-Z_][a-zA-Z_0-9]*)(?=[\\n\\s])",
|
||||
"captures": {
|
||||
"1": {
|
||||
@@ -573,7 +583,7 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"signal-declaration": {
|
||||
"signal_declaration": {
|
||||
"name": "meta.signal.gdscript",
|
||||
"begin": "(?x) \\s*\n (signal) \\s+\n ([a-zA-Z_][a-zA-Z_0-9]*) \\s*\n (?=\\()",
|
||||
"end": "((?=[#'\"\\n]))",
|
||||
@@ -590,7 +600,7 @@
|
||||
"include": "#parameters"
|
||||
},
|
||||
{
|
||||
"include": "#line-continuation"
|
||||
"include": "#line_continuation"
|
||||
},
|
||||
{
|
||||
"match": "\\s*(\\-\\>)\\s*([a-zA-Z_][a-zA-Z_0-9]*)\\s*\\:",
|
||||
@@ -620,14 +630,14 @@
|
||||
"include": "#parameters"
|
||||
},
|
||||
{
|
||||
"include": "#line-continuation"
|
||||
"include": "#line_continuation"
|
||||
}
|
||||
]
|
||||
},
|
||||
"function-declaration": {
|
||||
"function_declaration": {
|
||||
"name": "meta.function.gdscript",
|
||||
"begin": "(?x) \\s*\n (func) \\s+\n ([a-zA-Z_][a-zA-Z_0-9]*) \\s*\n (?=\\()",
|
||||
"end": "(:|(?=[#'\"\\n]))",
|
||||
"end": "((:)|(?=[#'\"\\n]))",
|
||||
"beginCaptures": {
|
||||
"1": {
|
||||
"name": "storage.type.function.gdscript"
|
||||
@@ -636,12 +646,17 @@
|
||||
"name": "entity.name.function.gdscript"
|
||||
}
|
||||
},
|
||||
"endCaptures": {
|
||||
"1": {
|
||||
"name": "punctuation.section.function.begin.gdscript"
|
||||
}
|
||||
},
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#parameters"
|
||||
},
|
||||
{
|
||||
"include": "#line-continuation"
|
||||
"include": "#line_continuation"
|
||||
},
|
||||
{
|
||||
"match": "\\s*(\\-\\>)\\s*([a-zA-Z_][a-zA-Z_0-9]*)\\s*\\:",
|
||||
@@ -674,7 +689,7 @@
|
||||
},
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#annotated-parameter"
|
||||
"include": "#annotated_parameter"
|
||||
},
|
||||
{
|
||||
"match": "(?x)\n ([[:alpha:]_]\\w*)\n \\s* (?: (,) | (?=[)#\\n=]))\n",
|
||||
@@ -691,11 +706,11 @@
|
||||
"include": "#comment"
|
||||
},
|
||||
{
|
||||
"include": "#loose-default"
|
||||
"include": "#loose_default"
|
||||
}
|
||||
]
|
||||
},
|
||||
"loose-default": {
|
||||
"loose_default": {
|
||||
"begin": "(=)",
|
||||
"end": "(,)|(?=\\))",
|
||||
"beginCaptures": {
|
||||
@@ -714,7 +729,7 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
"annotated-parameter": {
|
||||
"annotated_parameter": {
|
||||
"begin": "(?x)\n \\b\n ([[:alpha:]_]\\w*) \\s* (:)\n",
|
||||
"end": "(,)|(?=\\))",
|
||||
"beginCaptures": {
|
||||
@@ -740,44 +755,7 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
"annotated-parameter2": {
|
||||
"begin": "(?x)\n \\b\n ([[:alpha:]_]\\w*) \\s* (:) \\s* ([[:alpha:]_]\\w*)? \\s* (=)? \\s* ([[:alpha:].0-9\\'\\\"_]*)?\n",
|
||||
"end": "(,)|(?=\\))",
|
||||
"beginCaptures": {
|
||||
"1": {
|
||||
"name": "variable.parameter.function.language.gdscript"
|
||||
},
|
||||
"2": {
|
||||
"name": "punctuation.separator.annotation.gdscript"
|
||||
},
|
||||
"3": {
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#builtin_classes"
|
||||
},
|
||||
{
|
||||
"include": "#pascal_case_class"
|
||||
}
|
||||
]
|
||||
},
|
||||
"4": {
|
||||
"name": "keyword.operator.assignment.gdscript"
|
||||
},
|
||||
"5": {
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#base_expression"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"endCaptures": {
|
||||
"1": {
|
||||
"name": "punctuation.separator.parameters.gdscript"
|
||||
}
|
||||
}
|
||||
},
|
||||
"line-continuation": {
|
||||
"line_continuation": {
|
||||
"patterns": [
|
||||
{
|
||||
"match": "(\\\\)\\s*(\\S.*$\\n?)",
|
||||
@@ -806,15 +784,15 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
"any-method": {
|
||||
"any_method": {
|
||||
"match": "\\b([A-Za-z_]\\w*)\\b(?=\\s*(?:[(]))",
|
||||
"name": "support.function.any-method.gdscript"
|
||||
},
|
||||
"any-property": {
|
||||
"any_property": {
|
||||
"match": "(?<=[^.]\\.)\\b([A-Za-z_]\\w*)\\b(?![(])",
|
||||
"name": "variable.other.property.gdscript"
|
||||
},
|
||||
"function-call": {
|
||||
"function_call": {
|
||||
"name": "meta.function-call.gdscript",
|
||||
"comment": "Regular function call of the type \"name(args)\"",
|
||||
"begin": "(?x)\n \\b(?=\n ([[:alpha:]_]\\w*) \\s* (\\()\n )\n",
|
||||
@@ -826,14 +804,14 @@
|
||||
},
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#function-name"
|
||||
"include": "#function_name"
|
||||
},
|
||||
{
|
||||
"include": "#function-arguments"
|
||||
"include": "#function_arguments"
|
||||
}
|
||||
]
|
||||
},
|
||||
"function-name": {
|
||||
"function_name": {
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#builtin_func"
|
||||
@@ -848,7 +826,7 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
"function-arguments": {
|
||||
"function_arguments": {
|
||||
"begin": "(\\()",
|
||||
"end": "(?=\\))(?!\\)\\s*\\()",
|
||||
"beginCaptures": {
|
||||
|
||||
Reference in New Issue
Block a user