1
0
Эх сурвалжийг харах

Add support for apexdoc (based on java javadoc support)

olane 7 жил өмнө
parent
commit
40dfb97e56

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

@@ -198,6 +198,24 @@ testTokenization('apex', [
 		]
 	}],
 
+	// Comments - apex doc, multiple lines
+	[{
+		line: '/** start of Apex Doc',
+		tokens: [
+			{ startIndex: 0, type: 'comment.doc.apex' }
+		]
+	}, {
+		line: 'a comment between without a star',
+		tokens: [
+			{ startIndex: 0, type: 'comment.doc.apex' }
+		]
+	}, {
+		line: 'end of multiline comment*/',
+		tokens: [
+			{ startIndex: 0, type: 'comment.doc.apex' }
+		]
+	}],
+
 	// Keywords
 	[{
 		line: 'package test; class Program { static void main(String[] args) {} } }',

+ 8 - 0
src/apex/apex.ts

@@ -269,6 +269,7 @@ export const language = <ILanguage>{
 
 		whitespace: [
 			[/[ \t\r\n]+/, ''],
+			[/\/\*\*(?!\/)/, 'comment.doc', '@apexdoc'],
 			[/\/\*/, 'comment', '@comment'],
 			[/\/\/.*$/, 'comment'],
 		],
@@ -281,6 +282,13 @@ export const language = <ILanguage>{
 			[/[\/*]/, 'comment']
 		],
 
+		//Identical copy of comment above, except for the addition of .doc
+		apexdoc: [
+			[/[^\/*]+/, 'comment.doc'],
+			[/\*\//, 'comment.doc', '@pop'],
+			[/[\/*]/, 'comment.doc']
+		],
+
 		string: [
 			[/[^\\"']+/, 'string'],
 			[/@escapes/, 'string.escape'],