From 40dfb97e568926bc35bdf7bb7692ba8173bbd1ce Mon Sep 17 00:00:00 2001 From: olane Date: Fri, 10 Aug 2018 12:37:20 +0100 Subject: [PATCH] Add support for apexdoc (based on java javadoc support) --- src/apex/apex.test.ts | 18 ++++++++++++++++++ src/apex/apex.ts | 8 ++++++++ 2 files changed, 26 insertions(+) diff --git a/src/apex/apex.test.ts b/src/apex/apex.test.ts index 8511a03f..1b25de2a 100644 --- a/src/apex/apex.test.ts +++ b/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) {} } }', diff --git a/src/apex/apex.ts b/src/apex/apex.ts index 258172f7..6773dea0 100644 --- a/src/apex/apex.ts +++ b/src/apex/apex.ts @@ -269,6 +269,7 @@ export const language = { whitespace: [ [/[ \t\r\n]+/, ''], + [/\/\*\*(?!\/)/, 'comment.doc', '@apexdoc'], [/\/\*/, 'comment', '@comment'], [/\/\/.*$/, 'comment'], ], @@ -281,6 +282,13 @@ export const language = { [/[\/*]/, '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'],