diff --git a/platform/indexing-impl/src/com/intellij/ide/highlighter/custom/CustomFileTypeLexer.java b/platform/indexing-impl/src/com/intellij/ide/highlighter/custom/CustomFileTypeLexer.java index 587d433ca988..505e4560a26e 100644 --- a/platform/indexing-impl/src/com/intellij/ide/highlighter/custom/CustomFileTypeLexer.java +++ b/platform/indexing-impl/src/com/intellij/ide/highlighter/custom/CustomFileTypeLexer.java @@ -62,12 +62,12 @@ public final class CustomFileTypeLexer extends AbstractCustomLexer { ArrayList tokenParsers = new ArrayList<>(); tokenParsers.add(new WhitespaceParser()); - if (lineCommentParser != null) { - tokenParsers.add(lineCommentParser); - } if (multilineCommentParser != null) { tokenParsers.add(multilineCommentParser); } + if (lineCommentParser != null) { + tokenParsers.add(lineCommentParser); + } tokenParsers.add(keywordParser); tokenParsers.add(quotedStringParser); tokenParsers.add(quotedStringParser2); diff --git a/platform/platform-tests/testSrc/com/intellij/ide/highlighter/custom/CustomFileTypeLexerTest.groovy b/platform/platform-tests/testSrc/com/intellij/ide/highlighter/custom/CustomFileTypeLexerTest.groovy index 0f83933fe8b0..d7da3ff5efc1 100644 --- a/platform/platform-tests/testSrc/com/intellij/ide/highlighter/custom/CustomFileTypeLexerTest.groovy +++ b/platform/platform-tests/testSrc/com/intellij/ide/highlighter/custom/CustomFileTypeLexerTest.groovy @@ -272,6 +272,14 @@ MULTI_LINE_COMMENT ('/* a\\n *bc */') doTest createJavaSyntaxTable(), "//", 'LINE_COMMENT (\'//\')\n' } + void "test block comment start overrides line comment start"() { + def table = new SyntaxTable() + table.lineComment = '#' + table.startComment = '#{' + table.endComment = '}#' + doTest table, "#{ \nblock\n #}", 'MULTI_LINE_COMMENT (\'#{ \\nblock\\n #}\')\n' + } + void testEmpty() { doTest createJavaSyntaxTable(), "", '' }