Sfoglia il codice sorgente

Formatting and Highlighting Fixes (#812)

Fixes #805 and #810
David Kincaid 5 mesi fa
parent
commit
0203cec293

+ 5 - 1
src/formatter/snapshots/operators.gd

@@ -26,4 +26,8 @@ func f():
 
 	print(x == 1)
 	print(x <= 1)
-	print(x >= 1)
+	print(x >= 1)
+
+	var ij := 1
+	var k := -ij + 1
+	var m := 0 + -ij

+ 2 - 2
src/formatter/textmate.ts

@@ -186,15 +186,15 @@ function between(tokens: Token[], current: number, options: FormatterOptions) {
 	if (prev === "@") return "";
 
 	if (prev === "-" || prev === "+") {
-		if (nextToken.identifier) return " ";
 		if (next === "(") return " ";
-		if (current === 1) return "";
 		if (["keyword", "symbol"].includes(tokens[current - 2]?.type)) {
 			return "";
 		}
 		if ([",", "(", "["].includes(tokens[current - 2]?.value)) {
 			return "";
 		}
+		if (nextToken.identifier) return " ";
+		if (current === 1) return "";
 	}
 
 	if (prev === ":" && next === "=") return "";

+ 5 - 1
syntaxes/GDScript.tmLanguage.json

@@ -272,7 +272,11 @@
 					"name": "constant.numeric.float.gdscript"
 				},
 				{
-					"match": "([0-9][0-9_]*)?\\.[0-9_]*([eE][+-]?[0-9_]+)?",
+					"match": "([0-9][0-9_]*)\\.[0-9_]*([eE][+-]?[0-9_]+)?",
+					"name": "constant.numeric.float.gdscript"
+				},
+				{
+					"match": "([0-9][0-9_]*)?\\.[0-9_]*([eE][+-]?[0-9_]+)",
 					"name": "constant.numeric.float.gdscript"
 				},
 				{