mirror of
https://github.com/godotengine/godot-vscode-plugin.git
synced 2025-12-31 13:48:24 +03:00
More Formatter Fixes (#672)
* Fix nodepath function highlighting/tokenization * Reverted dangerous line removal behavior change * Fix detection of match keyword vs .match() function * Rearrange formatter options * Fix option default value * Add biome linter/formatter config file * Fix linter errors * Add system to supply custom config values in tests * Remove unused variable * Implement tests for both formatter options * Clean up formatter option handling * Fix extra space inserted in list of nodepaths * Add token rules for square and curly braces
This commit is contained in:
@@ -69,6 +69,9 @@
|
||||
{ "include": "#assignment_operator" },
|
||||
{ "include": "#in_keyword" },
|
||||
{ "include": "#control_flow" },
|
||||
{ "include": "#match_keyword" },
|
||||
{ "include": "#curly_braces" },
|
||||
{ "include": "#square_braces" },
|
||||
{ "include": "#round_braces" },
|
||||
{ "include": "#function_call" },
|
||||
{ "include": "#comment" },
|
||||
@@ -146,6 +149,8 @@
|
||||
]
|
||||
},
|
||||
"nodepath_function": {
|
||||
"name": "meta.function.gdscript",
|
||||
"contentName": "meta.function.parameters.gdscript",
|
||||
"begin": "(get_node_or_null|has_node|has_node_and_resource|find_node|get_node)\\s*(\\()",
|
||||
"beginCaptures": {
|
||||
"1": { "name": "entity.name.function.gdscript" },
|
||||
@@ -164,7 +169,8 @@
|
||||
"name": "keyword.control.flow"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{ "include": "#base_expression" }
|
||||
]
|
||||
},
|
||||
"self": {
|
||||
@@ -231,9 +237,13 @@
|
||||
"name": "keyword.operator.assignment.gdscript"
|
||||
},
|
||||
"control_flow": {
|
||||
"match": "\\b(?:if|elif|else|while|break|continue|pass|return|match|when|yield|await)\\b",
|
||||
"match": "\\b(?:if|elif|else|while|break|continue|pass|return|when|yield|await)\\b",
|
||||
"name": "keyword.control.gdscript"
|
||||
},
|
||||
"match_keyword": {
|
||||
"match": "^\n\\s*(match)",
|
||||
"captures": { "1": { "name": "keyword.control.gdscript" } }
|
||||
},
|
||||
"keywords": {
|
||||
"match": "\\b(?:class|class_name|is|onready|tool|static|export|as|void|enum|preload|assert|breakpoint|sync|remote|master|puppet|slave|remotesync|mastersync|puppetsync|trait|namespace)\\b",
|
||||
"name": "keyword.language.gdscript"
|
||||
@@ -544,6 +554,26 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
"curly_braces": {
|
||||
"begin": "\\{",
|
||||
"end": "\\}",
|
||||
"beginCaptures": { "0": { "name": "punctuation.definition.dict.begin.gdscript" } },
|
||||
"endCaptures": { "0": { "name": "punctuation.definition.dict.end.gdscript" } },
|
||||
"patterns": [
|
||||
{ "include": "#base_expression" },
|
||||
{ "include": "#any_variable" }
|
||||
]
|
||||
},
|
||||
"square_braces": {
|
||||
"begin": "\\[",
|
||||
"end": "\\]",
|
||||
"beginCaptures": { "0": { "name": "punctuation.definition.list.begin.gdscript" } },
|
||||
"endCaptures": { "0": { "name": "punctuation.definition.list.end.gdscript" } },
|
||||
"patterns": [
|
||||
{ "include": "#base_expression" },
|
||||
{ "include": "#any_variable" }
|
||||
]
|
||||
},
|
||||
"round_braces": {
|
||||
"begin": "\\(",
|
||||
"end": "\\)",
|
||||
|
||||
@@ -45,6 +45,12 @@ func f():
|
||||
super()
|
||||
super.some_function()
|
||||
|
||||
match param3:
|
||||
3:
|
||||
print("param3 is 3!")
|
||||
_:
|
||||
print("param3 is not 3!")
|
||||
|
||||
for i in range(1): # `in` is a control keyword
|
||||
print(i in range(1)) # `in` is an operator keyword
|
||||
|
||||
|
||||
Reference in New Issue
Block a user