Browse Source

Fixes microsoft/monaco-editor#1935

Alex Dima 4 năm trước cách đây
mục cha
commit
60477286f3
2 tập tin đã thay đổi với 18 bổ sung0 xóa
  1. 16 0
      src/dockerfile/dockerfile.test.ts
  2. 2 0
      src/dockerfile/dockerfile.ts

+ 16 - 0
src/dockerfile/dockerfile.test.ts

@@ -223,5 +223,21 @@ testTokenization('dockerfile', [
 				{ startIndex: 45, type: 'string.dockerfile' }
 			]
 		}
+	],
+	[
+		{
+			line: "RUN \\'e\\'",
+			tokens: [
+				{ startIndex: 0, type: 'keyword.dockerfile' },
+				{ startIndex: 3, type: '' }
+			]
+		},
+		{
+			line: 'RUN echo hi this is # not a comment',
+			tokens: [
+				{ startIndex: 0, type: 'keyword.dockerfile' },
+				{ startIndex: 3, type: '' }
+			]
+		}
 	]
 ]);

+ 2 - 0
src/dockerfile/dockerfile.ts

@@ -99,6 +99,8 @@ export const language = <languages.IMonarchLanguage>{
 
 		// Recognize strings, including those broken across lines with \ (but not without)
 		strings: [
+			[/\\'$/, '', '@popall'], // \' leaves @arguments at eol
+			[/\\'/, ''], // \' is not a string
 			[/'$/, 'string', '@popall'],
 			[/'/, 'string', '@stringBody'],
 			[/"$/, 'string', '@popall'],