Explorar o código

fix r roxygen comment highlighting #2086

nreed %!s(int64=4) %!d(string=hai) anos
pai
achega
65554d83e3
Modificáronse 2 ficheiros con 17 adicións e 1 borrados
  1. 15 0
      src/r/r.test.ts
  2. 2 1
      src/r/r.ts

+ 15 - 0
src/r/r.test.ts

@@ -101,6 +101,21 @@ testTokenization('r', [
 			]
 		}
 	],
+	[
+		{
+			line: " #'",
+			tokens: [
+				{ startIndex: 0, type: 'white.r' },
+				{ startIndex: 1, type: 'comment.doc.r' }
+			]			
+		},
+		{
+			line: " ",
+			tokens: [
+				{ startIndex: 0, type: 'white.r' },
+			]
+		}
+	],
 
 	// Strings
 	[

+ 2 - 1
src/r/r.ts

@@ -163,7 +163,7 @@ export const language = <languages.IMonarchLanguage>{
 			[/[{}\[\]()]/, '@brackets'],
 
 			{ include: '@operators' },
-
+			[/#'$/, 'comment.doc'],
 			[/#'/, 'comment.doc', '@roxygen'],
 			[/(^#.*$)/, 'comment'],
 
@@ -186,6 +186,7 @@ export const language = <languages.IMonarchLanguage>{
 
 		// Recognize Roxygen comments
 		roxygen: [
+			[/(^$)/, { token: 'comment.doc', next: '@pop' }],
 			[
 				/@\w+/,
 				{