diff --git a/app/src/processing/app/syntax/SketchTokenMaker.java b/app/src/processing/app/syntax/SketchTokenMaker.java index 14a1d936f..7ea7e998c 100644 --- a/app/src/processing/app/syntax/SketchTokenMaker.java +++ b/app/src/processing/app/syntax/SketchTokenMaker.java @@ -30,8 +30,12 @@ package processing.app.syntax; +import org.fife.ui.rsyntaxtextarea.TokenTypes; import org.fife.ui.rsyntaxtextarea.modes.CPlusPlusTokenMaker; +import java.util.Arrays; +import java.util.List; + /** * Controls the syntax highlighting of {@link SketchTextArea} based on the {@link PdeKeywords} * @@ -41,6 +45,8 @@ import org.fife.ui.rsyntaxtextarea.modes.CPlusPlusTokenMaker; */ public class SketchTokenMaker extends CPlusPlusTokenMaker { + private static final List COMMENT_TOKEN_TYPES = Arrays.asList(TokenTypes.COMMENT_DOCUMENTATION, TokenTypes.COMMENT_EOL, TokenTypes.COMMENT_KEYWORD, TokenTypes.COMMENT_MARKUP, TokenTypes.COMMENT_MULTILINE); + private final PdeKeywords pdeKeywords; public SketchTokenMaker(PdeKeywords pdeKeywords) { @@ -54,6 +60,11 @@ public class SketchTokenMaker extends CPlusPlusTokenMaker { return; } + if (COMMENT_TOKEN_TYPES.contains(tokenType)) { + super.addToken(array, start, end, tokenType, startOffset, hyperlink); + return; + } + // This assumes all of your extra tokens would normally be scanned as IDENTIFIER. int newType = pdeKeywords.getTokenType(array, start, end); if (newType > -1) {