Przeglądaj źródła

Fixes Microsoft/monaco-editor#1213

Alex Dima 6 lat temu
rodzic
commit
e174b96db8
2 zmienionych plików z 20 dodań i 2 usunięć
  1. 18 0
      src/php/php.test.ts
  2. 2 2
      src/php/php.ts

+ 18 - 0
src/php/php.test.ts

@@ -2076,5 +2076,23 @@ testTokenization(['php', 'css', 'javascript'], [
 			{ startIndex: 17, type: '' },
 			{ startIndex: 17, type: '' },
 			{ startIndex: 18, type: 'metatag.php' }
 			{ startIndex: 18, type: 'metatag.php' }
 		]
 		]
+	}],
+
+	[{
+		line: '<?php',
+		tokens: [
+			{ startIndex: 0, type: 'metatag.php' },
+		]
+	}, {
+		line: '  //',
+		tokens: [
+			{ startIndex: 0, type: '' },
+			{ startIndex: 2, type: 'comment.php' },
+		]
+	}, {
+		line: 'if',
+		tokens: [
+			{ startIndex: 0, type: 'keyword.php' },
+		]
 	}]
 	}]
 ]);
 ]);

+ 2 - 2
src/php/php.ts

@@ -225,8 +225,8 @@ export const language = <ILanguage>{
 			[/[ \t\r\n]+/],
 			[/[ \t\r\n]+/],
 
 
 			// comments
 			// comments
-			[/#/, 'comment.php', '@phpLineComment'],
-			[/\/\//, 'comment.php', '@phpLineComment'],
+			[/(#|\/\/)$/, 'comment.php'],
+			[/(#|\/\/)/, 'comment.php', '@phpLineComment'],
 
 
 			// block comments
 			// block comments
 			[/\/\*/, 'comment.php', '@phpComment'],
 			[/\/\*/, 'comment.php', '@phpComment'],