Bläddra i källkod

Fixes microsoft/monaco-editor#2398

Alex Dima 4 år sedan
förälder
incheckning
d6197d6e14
2 ändrade filer med 26 tillägg och 1 borttagningar
  1. 25 0
      src/yaml/yaml.test.ts
  2. 1 1
      src/yaml/yaml.ts

+ 25 - 0
src/yaml/yaml.test.ts

@@ -449,5 +449,30 @@ testTokenization('yaml', [
 				}
 				}
 			]
 			]
 		}
 		}
+	],
+	[
+		{
+			line:
+				"text: Pretty vector drawing. #this is comment doesn't have proper syntax higlighting",
+			tokens: [
+				{ startIndex: 0, type: 'type.yaml' },
+				{ startIndex: 4, type: 'operators.yaml' },
+				{ startIndex: 5, type: 'white.yaml' },
+				{ startIndex: 6, type: 'string.yaml' },
+				{ startIndex: 29, type: 'comment.yaml' }
+			]
+		}
+	],
+	[
+		{
+			line: "number: 3 #this comment also doesn't have proper syntax highlighting",
+			tokens: [
+				{ startIndex: 0, type: 'type.yaml' },
+				{ startIndex: 6, type: 'operators.yaml' },
+				{ startIndex: 7, type: 'white.yaml' },
+				{ startIndex: 8, type: 'string.yaml' },
+				{ startIndex: 10, type: 'comment.yaml' }
+			]
+		}
 	]
 	]
 ]);
 ]);

+ 1 - 1
src/yaml/yaml.ts

@@ -84,7 +84,7 @@ export const language = <languages.IMonarchLanguage>{
 
 
 			// String nodes
 			// String nodes
 			[
 			[
-				/.+$/,
+				/[^#]+/,
 				{
 				{
 					cases: {
 					cases: {
 						'@keywords': 'keyword',
 						'@keywords': 'keyword',