com.intellij.openapi.editor.colors.TextAttributesKey Java Examples

The following examples show how to use com.intellij.openapi.editor.colors.TextAttributesKey. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CsvColorSettings.java    From intellij-csv-validator with Apache License 2.0 6 votes vote down vote up
public static TextAttributes getTextAttributesOfColumn(int columnIndex, UserDataHolder userDataHolder) {
    List<TextAttributes> textAttributeList = userDataHolder.getUserData(COLUMN_HIGHLIGHT_TEXT_ATTRIBUTES_KEY);
    if (textAttributeList == null) {
        EditorColorsScheme editorColorsScheme = EditorColorsManager.getInstance().getGlobalScheme();
        textAttributeList = new ArrayList<>();
        int maxIndex = 0;
        for (int colorDescriptorIndex = 0; colorDescriptorIndex < MAX_COLUMN_HIGHLIGHT_COLORS; ++colorDescriptorIndex) {
            TextAttributesKey textAttributesKey = COLUMN_HIGHLIGHT_ATTRIBUTES.get(colorDescriptorIndex);
            TextAttributes textAttributes = editorColorsScheme.getAttributes(textAttributesKey);
            textAttributeList.add(textAttributes);
            if (!textAttributesKey.getDefaultAttributes().equals(textAttributes)) {
                maxIndex = colorDescriptorIndex;
            }
        }
        textAttributeList = textAttributeList.subList(0, maxIndex + 1);
        userDataHolder.putUserData(COLUMN_HIGHLIGHT_TEXT_ATTRIBUTES_KEY, textAttributeList);
    }
    return textAttributeList.isEmpty() ? null : textAttributeList.get(columnIndex % textAttributeList.size());
}
 
Example #2
Source File: DotEnvSyntaxHighlighter.java    From idea-php-dotenv-plugin with MIT License 6 votes vote down vote up
@NotNull
@Override
public TextAttributesKey[] getTokenHighlights(IElementType tokenType) {
    if (tokenType.equals(DotEnvTypes.SEPARATOR)) {
        return SEPARATOR_KEYS;
    } else if (tokenType.equals(DotEnvTypes.KEY_CHARS)) {
        return KEY_KEYS;
    } else if (tokenType.equals(DotEnvTypes.VALUE_CHARS)) {
        return VALUE_KEYS;
    } else if (tokenType.equals(DotEnvTypes.COMMENT) || tokenType.equals(DotEnvTypes.EXPORT)) {
        return COMMENT_KEYS;
    } else if (tokenType.equals(TokenType.BAD_CHARACTER)) {
        return BAD_CHAR_KEYS;
    } else {
        return EMPTY_KEYS;
    }
}
 
Example #3
Source File: EditorColorsSchemeImpl.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Override
public TextAttributes getAttributes(TextAttributesKey key) {
  if (key != null) {
    TextAttributesKey fallbackKey = key.getFallbackAttributeKey();
    TextAttributes attributes = myAttributesMap.get(key);
    if (fallbackKey == null) {
      if (attributes != null) return attributes;
    }
    else {
      if (attributes != null && !attributes.isFallbackEnabled()) return attributes;
      attributes = getFallbackAttributes(fallbackKey);
      if (attributes != null) return attributes;
    }
  }
  return myParentScheme.getAttributes(key);
}
 
Example #4
Source File: TypoScriptSyntaxHighlighter.java    From idea-php-typo3-plugin with MIT License 6 votes vote down vote up
@NotNull
@Override
public TextAttributesKey[] getTokenHighlights(IElementType tokenType) {
    if (tokenType.equals(TypoScriptTypes.DOT)) {
        return SEPARATOR_KEYS;
    } else if (tokenType.equals(TypoScriptTypes.IDENTIFIER)) {
        return KEY_KEYS;
    } else if (tokenType.equals(TypoScriptTypes.VALUE)) {
        return VALUE_KEYS;
    } else if (tokenType.equals(TypoScriptTypes.COMMENT)) {
        return COMMENT_KEYS;
    } else if (tokenType.equals(TokenType.BAD_CHARACTER)) {
        return BAD_CHAR_KEYS;
    } else {
        return EMPTY_KEYS;
    }
}
 
Example #5
Source File: JavaAnnotator.java    From Custom-Syntax-Highlighter with MIT License 6 votes vote down vote up
@Override
protected TextAttributesKey getKeywordKind(@NotNull final PsiElement element) {
  TextAttributesKey kind = null;
  switch (element.getText()) {
    case "private":
    case "public":
    case "protected":
      kind = MODIFIER;
      break;
    case "static":
    case "final":
      kind = STATIC_FINAL;
      break;
    case "this":
    case "super":
      kind = THIS_SUPER;
      break;
  }
  return kind;
}
 
Example #6
Source File: ColorAndFontOptions.java    From consulo with Apache License 2.0 6 votes vote down vote up
private SchemeTextAttributesDescription(String name, String group, @Nonnull TextAttributesKey key, @Nonnull MyColorScheme scheme, Image icon, String toolTip) {
  super(name, group, getInitialAttributes(scheme, key).clone(), key, scheme, icon, toolTip);
  this.key = key;
  myAttributesToApply = getInitialAttributes(scheme, key);
  TextAttributesKey fallbackKey = key.getFallbackAttributeKey();
  if (fallbackKey != null) {
    myFallbackAttributes = scheme.getAttributes(fallbackKey);
    myBaseAttributeDescriptor = ColorSettingsPages.getInstance().getAttributeDescriptor(fallbackKey);
    if (myBaseAttributeDescriptor == null) {
      myBaseAttributeDescriptor = new Pair<>(null, new AttributesDescriptor(fallbackKey.getExternalName(), fallbackKey));
    }
  }
  myIsInheritedInitial = isInherited(scheme);
  setInherited(myIsInheritedInitial);
  initCheckedStatus();
}
 
Example #7
Source File: DiffOptionsPanel.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Override
public void updateOptionsList() {
  myOptionsModel.clear();
  myDescriptions.clear();
  Map<TextAttributesKey, TextDiffType> typesByKey = ContainerUtil.newMapFromValues(TextDiffType.MERGE_TYPES.iterator(),
                                                                                   TextDiffType.ATTRIBUTES_KEY);
  for (int i = 0; i < myOptions.getCurrentDescriptions().length; i++) {
    EditorSchemeAttributeDescriptor description = myOptions.getCurrentDescriptions()[i];
    TextAttributesKey type = TextAttributesKey.find(description.getType());
    if (description.getGroup() == ColorAndFontOptions.DIFF_GROUP &&
        typesByKey.keySet().contains(type)) {
      myOptionsModel.add(typesByKey.get(type));
      myDescriptions.put(type.getExternalName(), (MyColorAndFontDescription)description);
    }
  }
  ScrollingUtil.ensureSelectionExists(myOptionsList);
}
 
Example #8
Source File: BcfgSyntaxHighlighter.java    From buck with Apache License 2.0 6 votes vote down vote up
@NotNull
@Override
public TextAttributesKey[] getTokenHighlights(@Nullable IElementType tokenType) {
  if (BcfgTypes.COMMENT.equals(tokenType)) {
    return COMMENT_KEYS;
  } else if (BcfgTypes.L_BRACKET.equals(tokenType)
      || BcfgTypes.R_BRACKET.equals(tokenType)
      || BcfgTypes.REQUIRED_FILE.equals(tokenType)
      || BcfgTypes.OPTIONAL_FILE.equals(tokenType)
      || BcfgTypes.END_INLINE.equals(tokenType)
      || BcfgTypes.ASSIGN.equals(tokenType)) {
    return PUNCTUATION_KEYS;
  } else if (BcfgTypes.PROPERTY_VALUE_FRAGMENT.equals(tokenType)) {
    return VALUE_KEYS;
  } else if (BcfgTypes.SECTION_NAME.equals(tokenType)) {
    return SECTION_KEYS;
  } else if (BcfgTypes.PROPERTY_NAME.equals(tokenType)) {
    return PROPERTY_KEYS;
  } else if (BcfgTypes.FILE_PATH.equals(tokenType)) {
    return FILE_PATH_KEYS;
  } else if (TokenType.BAD_CHARACTER.equals(tokenType)) {
    return BAD_CHAR_KEYS;
  } else {
    return EMPTY_KEYS;
  }
}
 
Example #9
Source File: SimpleSyntaxHighlighter.java    From intellij-sdk-docs with Apache License 2.0 6 votes vote down vote up
@NotNull
@Override
public TextAttributesKey[] getTokenHighlights(IElementType tokenType) {
  if (tokenType.equals(SimpleTypes.SEPARATOR)) {
    return SEPARATOR_KEYS;
  } else if (tokenType.equals(SimpleTypes.KEY)) {
    return KEY_KEYS;
  } else if (tokenType.equals(SimpleTypes.VALUE)) {
    return VALUE_KEYS;
  } else if (tokenType.equals(SimpleTypes.COMMENT)) {
    return COMMENT_KEYS;
  } else if (tokenType.equals(TokenType.BAD_CHARACTER)) {
    return BAD_CHAR_KEYS;
  } else {
    return EMPTY_KEYS;
  }
}
 
Example #10
Source File: SyntaxHighlighterOverEditorHighlighter.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Nonnull
@Override
public TextAttributesKey[] getTokenHighlights(IElementType tokenType) {
  final SyntaxHighlighter activeSyntaxHighlighter =
          layeredHighlighterIterator != null ? layeredHighlighterIterator.getActiveSyntaxHighlighter() : highlighter;
  return activeSyntaxHighlighter.getTokenHighlights(tokenType);
}
 
Example #11
Source File: NodeRenderer.java    From consulo with Apache License 2.0 5 votes vote down vote up
public static SimpleTextAttributes getSimpleTextAttributes(@Nullable final ItemPresentation presentation,
                                                           @Nonnull EditorColorsScheme colorsScheme)
{
  if (presentation instanceof ColoredItemPresentation) {
    final TextAttributesKey textAttributesKey = ((ColoredItemPresentation) presentation).getTextAttributesKey();
    if (textAttributesKey == null) return SimpleTextAttributes.REGULAR_ATTRIBUTES;
    final TextAttributes textAttributes = colorsScheme.getAttributes(textAttributesKey);
    return textAttributes == null ? SimpleTextAttributes.REGULAR_ATTRIBUTES : SimpleTextAttributes.fromTextAttributes(textAttributes);
  }
  return SimpleTextAttributes.REGULAR_ATTRIBUTES;
}
 
Example #12
Source File: RTSyntaxHighlighterFactory.java    From react-templates-plugin with MIT License 5 votes vote down vote up
@NotNull
public TextAttributesKey[] getTokenHighlights(final IElementType tokenType) {
    if (myKeysMap.containsKey(tokenType)) {
        return pack(myKeysMap.get(tokenType));
    }
    return super.getTokenHighlights(tokenType);
}
 
Example #13
Source File: JSColorSettings.java    From Custom-Syntax-Highlighter with MIT License 5 votes vote down vote up
private static Map<String, TextAttributesKey> createAdditionalHlAttrs() {
  final Map<String, TextAttributesKey> descriptors = new THashMap<>();
  descriptors.put("keyword", JSColorSettings.JSKEYWORD);
  descriptors.put("function", JSColorSettings.FUNCTION);
  descriptors.put("function_name", JSColorSettings.FUNCTION_NAME);
  descriptors.put("val", JSColorSettings.VAL);
  descriptors.put("local_variable", JSColorSettings.VARIABLE);
  descriptors.put("this", JSColorSettings.THIS_SUPER);
  descriptors.put("null", JSColorSettings.NULL);
  descriptors.put("debugger", JSColorSettings.DEBUGGER);
  descriptors.put("import", JSColorSettings.MODULE);

  return descriptors;
}
 
Example #14
Source File: TextDiffTypeFactory.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Nonnull
public synchronized TextDiffType createTextDiffType(@NonNls @Nonnull TextAttributesKey key,
                                                    @Nonnull String name) {
  TextDiffType type = new TextDiffTypeImpl(key, name);
  myTypes.add(type);
  return type;
}
 
Example #15
Source File: PsiElementListCellRenderer.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Nullable
protected TextAttributes getNavigationItemAttributes(Object value) {
  TextAttributes attributes = null;

  if (value instanceof NavigationItem) {
    TextAttributesKey attributesKey = null;
    final ItemPresentation presentation = ((NavigationItem)value).getPresentation();
    if (presentation instanceof ColoredItemPresentation) attributesKey = ((ColoredItemPresentation)presentation).getTextAttributesKey();

    if (attributesKey != null) {
      attributes = EditorColorsManager.getInstance().getGlobalScheme().getAttributes(attributesKey);
    }
  }
  return attributes;
}
 
Example #16
Source File: TSColorSettings.java    From Custom-Syntax-Highlighter with MIT License 5 votes vote down vote up
private static Map<String, TextAttributesKey> createAdditionalHlAttrs() {
  final Map<String, TextAttributesKey> descriptors = new THashMap<>();
  descriptors.put("private", PRIVATE);
  descriptors.put("class", DefaultLanguageHighlighterColors.CLASS_NAME);

  return descriptors;
}
 
Example #17
Source File: FileTemplateConfigurable.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
@Nonnull
public TextAttributesKey[] getTokenHighlights(IElementType tokenType) {
  if (tokenType == FileTemplateTokenType.MACRO || tokenType == FileTemplateTokenType.DIRECTIVE) {
    return pack(TemplateColors.TEMPLATE_VARIABLE_ATTRIBUTES);
  }

  return EMPTY;
}
 
Example #18
Source File: SyntaxHighlighterBase.java    From consulo with Apache License 2.0 5 votes vote down vote up
/**
 * Tries to update the map by associating given key with a given value.
 * Throws error if the map already contains different mapping for given key.
 */
protected static void safeMap(
  @Nonnull final Map<IElementType, TextAttributesKey> map,
  @Nonnull final IElementType type,
  @Nonnull final TextAttributesKey value)
{
  final TextAttributesKey oldVal = map.put(type, value);
  if (oldVal != null && !oldVal.equals(value)) {
    LOG.error("Remapping highlighting for \"" + type + "\" val: old=" + oldVal + " new=" + value);
  }
}
 
Example #19
Source File: SandHighlighter.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Nonnull
@Override
public TextAttributesKey[] getTokenHighlights(LanguageVersion languageVersion, IElementType tokenType) {
  BaseSandLanguageVersion sandLanguageVersion = (BaseSandLanguageVersion) languageVersion;
  if(sandLanguageVersion.getHighlightKeywords().contains(tokenType)) {
    return pack(SandHighlighterKeys.KEYWORD);
  }
  else if(sandLanguageVersion.getCommentTokens().contains(tokenType)) {
    return pack(SandHighlighterKeys.LINE_COMMENT);
  }
  return EMPTY;
}
 
Example #20
Source File: DiffOptionsPanel.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public void apply(EditorColorsScheme scheme) {
  TextAttributesKey key = myDiffType.getAttributesKey();
  TextAttributes attrs = new TextAttributes(null, myBackgroundColor, null, EffectType.BOXED, Font.PLAIN);
  attrs.setErrorStripeColor(myStripebarColor);
  scheme.setAttributes(key, attrs);
}
 
Example #21
Source File: FlutterLogView.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
private void computeTextAttributesByLogLevelCache() {
  final EditorColorsScheme globalEditorColorsScheme = EditorColorsManager.getInstance().getGlobalScheme();
  textAttributesByLogLevelCache.clear();
  for (Level level : FlutterLog.Level.values()) {
    try {
      final TextAttributesKey key = LOG_LEVEL_TEXT_ATTRIBUTES_KEY_MAP.get(level);
      final TextAttributes attributes = globalEditorColorsScheme.getAttributes(key);
      int fontType = attributes.getFontType();
      final Color effectColor = attributes.getEffectColor();
      final Integer textStyle = EFFECT_TYPE_TEXT_STYLE_MAP.get(attributes.getEffectType());
      // TextStyle can exist even when unchecked in settings page.
      // only effectColor is null when setting effect is unchecked in setting page.
      // So, we have to check that both effectColor & textStyle are not null.
      if (effectColor != null && textStyle != null) {
        fontType = fontType | textStyle;
      }

      final SimpleTextAttributes textAttributes = new SimpleTextAttributes(
        attributes.getBackgroundColor(),
        attributes.getForegroundColor(),
        effectColor,
        fontType
      );

      textAttributesByLogLevelCache.put(level, textAttributes);
    }
    catch (Exception e) {
      // Should never go here.
      FlutterUtils.warn(LOG, "Error when get text attributes by log level", e);
    }
  }
}
 
Example #22
Source File: SampleSyntaxHighlighter.java    From jetbrains-plugin-sample with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@NotNull
@Override
public TextAttributesKey[] getTokenHighlights(IElementType tokenType) {
	if ( !(tokenType instanceof TokenIElementType) ) return EMPTY_KEYS;
	TokenIElementType myType = (TokenIElementType)tokenType;
	int ttype = myType.getANTLRTokenType();
	TextAttributesKey attrKey;
	switch ( ttype ) {
		case SampleLanguageLexer.ID :
			attrKey = ID;
			break;
		case SampleLanguageLexer.VAR :
		case SampleLanguageLexer.WHILE :
		case SampleLanguageLexer.IF :
		case SampleLanguageLexer.ELSE :
		case SampleLanguageLexer.RETURN :
		case SampleLanguageLexer.PRINT :
		case SampleLanguageLexer.FUNC :
		case SampleLanguageLexer.TYPEINT :
		case SampleLanguageLexer.TYPEFLOAT :
		case SampleLanguageLexer.TYPESTRING :
		case SampleLanguageLexer.TYPEBOOLEAN :
		case SampleLanguageLexer.TRUE :
		case SampleLanguageLexer.FALSE :
			attrKey = KEYWORD;
			break;
		case SampleLanguageLexer.STRING :
			attrKey = STRING;
			break;
		case SampleLanguageLexer.COMMENT :
			attrKey = LINE_COMMENT;
			break;
		case SampleLanguageLexer.LINE_COMMENT :
			attrKey = BLOCK_COMMENT;
			break;
		default :
			return EMPTY_KEYS;
	}
	return new TextAttributesKey[] {attrKey};
}
 
Example #23
Source File: BraceHighlighter.java    From HighlightBracketPair with Apache License 2.0 5 votes vote down vote up
public Pair<RangeHighlighter, RangeHighlighter> highlightPair(BracePair bracePair) {
    final Brace leftBrace = bracePair.getLeftBrace();
    final Brace rightBrace = bracePair.getRightBrace();
    final int leftBraceOffset = leftBrace.getOffset();
    final int rightBraceOffset = rightBrace.getOffset();
    final String leftBraceText = leftBrace.getText();
    final String rightBraceText = rightBrace.getText();

    if (leftBraceOffset == NON_OFFSET ||
            rightBraceOffset == NON_OFFSET)
        return null;
    // try to get the text attr by element type
    TextAttributesKey textAttributesKey =
            HighlightBracketPairSettingsPage.getTextAttributesKeyByToken(leftBrace.getElementType());
    // if not found, get the text attr by brace text
    if (textAttributesKey == null) {
        textAttributesKey = HighlightBracketPairSettingsPage.getTextAttributesKeyByText(leftBraceText);
    }
    final TextAttributes textAttributes = editor.getColorsScheme().getAttributes(textAttributesKey);

    RangeHighlighter leftHighlighter = markupModelEx.addRangeHighlighter(
            leftBraceOffset,
            leftBraceOffset + leftBraceText.length(),
            HighlighterLayer.SELECTION + HIGHLIGHT_LAYER_WEIGHT,
            textAttributes,
            HighlighterTargetArea.EXACT_RANGE);
    RangeHighlighter rightHighlighter = markupModelEx.addRangeHighlighter(
            rightBraceOffset,
            rightBraceOffset + rightBraceText.length(),
            HighlighterLayer.SELECTION + HIGHLIGHT_LAYER_WEIGHT,
            textAttributes,
            HighlighterTargetArea.EXACT_RANGE);
    return new Pair<>(leftHighlighter, rightHighlighter);
}
 
Example #24
Source File: SyntaxHighlighterBase.java    From consulo with Apache License 2.0 5 votes vote down vote up
/**
 * Tries to update the map by associating given keys with a given value.
 * Throws error if the map already contains different mapping for one of given keys.
 */
protected static void safeMap(
  @Nonnull final Map<IElementType, TextAttributesKey> map,
  @Nonnull final TokenSet keys,
  @Nonnull final TextAttributesKey value)
{
  for (final IElementType type : keys.getTypes()) {
    safeMap(map, type, value);
  }
}
 
Example #25
Source File: HighlightDisplayLevel.java    From consulo with Apache License 2.0 5 votes vote down vote up
public static void registerSeverity(@Nonnull HighlightSeverity severity, final TextAttributesKey key, @javax.annotation.Nullable Icon icon) {
  Icon severityIcon = icon != null ? icon : createBoxIcon(key);
  final HighlightDisplayLevel level = ourMap.get(severity);
  if (level == null) {
    new HighlightDisplayLevel(severity, severityIcon);
  }
  else {
    level.myIcon = severityIcon;
  }
}
 
Example #26
Source File: CSharpHighlightUtil.java    From consulo-csharp with Apache License 2.0 5 votes vote down vote up
@Nullable
@RequiredReadAction
public static HighlightInfo highlightNamed(@Nonnull HighlightInfoHolder holder, @Nullable PsiElement element, @Nullable PsiElement target, @Nullable PsiElement owner)
{
	if(target == null || element == null)
	{
		return null;
	}

	IElementType elementType = target.getNode().getElementType();
	if(CSharpTokenSets.KEYWORDS.contains(elementType))  // don't highlight keywords
	{
		return null;
	}

	if(isMethodRef(owner, element))
	{
		HighlightInfo highlightInfo = HighlightInfo.newHighlightInfo(HighlightInfoType.INFORMATION).range(target).textAttributes(CSharpHighlightKey.METHOD_REF).create();
		holder.add(highlightInfo);
	}

	TextAttributesKey defaultTextAttributeKey = getDefaultTextAttributeKey(element, target);
	if(defaultTextAttributeKey == null)
	{
		return null;
	}

	HighlightInfo info = HighlightInfo.newHighlightInfo(HighlightInfoType.INFORMATION).range(target).textAttributes(defaultTextAttributeKey).create();
	holder.add(info);
	if(!(target instanceof CSharpIdentifier) && DotNetAttributeUtil.hasAttribute(element, DotNetTypes.System.ObsoleteAttribute))
	{
		holder.add(HighlightInfo.newHighlightInfo(HighlightInfoType.INFORMATION).range(target).textAttributes(CodeInsightColors.DEPRECATED_ATTRIBUTES).create());
	}

	return info;
}
 
Example #27
Source File: SimpleEditorPreview.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Nullable
private static String selectItem(HighlighterIterator itr, SyntaxHighlighter highlighter) {
  IElementType tokenType = itr.getTokenType();
  if (tokenType == null) return null;

  TextAttributesKey[] highlights = highlighter.getTokenHighlights(tokenType);
  String s = null;
  for (int i = highlights.length - 1; i >= 0; i--) {
    if (highlights[i] != HighlighterColors.TEXT) {
      s = highlights[i].getExternalName();
      break;
    }
  }
  return s == null ? HighlighterColors.TEXT.getExternalName() : s;
}
 
Example #28
Source File: ElmSyntaxHighlighter.java    From elm-plugin with MIT License 4 votes vote down vote up
@NotNull
@Override
public TextAttributesKey[] getTokenHighlights(IElementType tokenType) {
    return pack(keys.get(tokenType));
}
 
Example #29
Source File: LombokHighlightErrorFilter.java    From lombok-intellij-plugin with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
LombokHighlightFilter(@NotNull HighlightSeverity severity, @Nullable TextAttributesKey key) {
  this.severity = severity;
  this.key = key;
}
 
Example #30
Source File: LayerDescriptor.java    From consulo with Apache License 2.0 4 votes vote down vote up
public LayerDescriptor(@Nonnull SyntaxHighlighter layerHighlighter, @Nonnull String tokenSeparator, @Nullable TextAttributesKey background) {
  myBackground = background;
  myLayerHighlighter = layerHighlighter;
  myTokenSeparator = tokenSeparator;
}