@Override
    @NotNull
    public TextAttributesKey[] getTokenHighlights(IElementType tokenType) {
      if (tokenType == FileTemplateTokenType.MACRO) {
        return pack(
            myOriginalHighlighter.getTokenHighlights(tokenType),
            TemplateColors.TEMPLATE_VARIABLE_ATTRIBUTES);
      } else if (tokenType == FileTemplateTokenType.DIRECTIVE) {
        return pack(
            myOriginalHighlighter.getTokenHighlights(tokenType),
            TemplateColors.TEMPLATE_VARIABLE_ATTRIBUTES);
      }

      return myOriginalHighlighter.getTokenHighlights(tokenType);
    }
    public TemplateHighlighter(SyntaxHighlighter original) {
      myOriginalHighlighter = original;
      Lexer originalLexer = original.getHighlightingLexer();
      Lexer templateLexer = new FlexAdapter(new FileTemplateTextLexer());
      templateLexer = new MergingLexerAdapter(templateLexer, TOKENS_TO_MERGE);

      myLexer =
          new CompositeLexer(originalLexer, templateLexer) {
            @Override
            protected IElementType getCompositeTokenType(IElementType type1, IElementType type2) {
              if (type2 == FileTemplateTokenType.MACRO
                  || type2 == FileTemplateTokenType.DIRECTIVE) {
                return type2;
              } else {
                return type1;
              }
            }
          };
    }