Search in sources :

Example 1 with BidiRegionsSeparator

use of com.intellij.openapi.editor.bidi.BidiRegionsSeparator in project intellij-community by JetBrains.

the class LineLayout method distinctTokens.

private static boolean distinctTokens(@Nullable IElementType token1, @Nullable IElementType token2) {
    if (token1 == token2)
        return false;
    if (token1 == null || token2 == null)
        return true;
    if (StringEscapesTokenTypes.STRING_LITERAL_ESCAPES.contains(token1) || StringEscapesTokenTypes.STRING_LITERAL_ESCAPES.contains(token2))
        return false;
    if (token1 != TokenType.WHITE_SPACE && token2 != TokenType.WHITE_SPACE && !token1.getLanguage().is(token2.getLanguage()))
        return true;
    Language language = token1.getLanguage();
    if (language == Language.ANY)
        language = token2.getLanguage();
    BidiRegionsSeparator separator = LanguageBidiRegionsSeparator.INSTANCE.forLanguage(language);
    return separator.createBorderBetweenTokens(token1, token2);
}
Also used : Language(com.intellij.lang.Language) LanguageBidiRegionsSeparator(com.intellij.openapi.editor.bidi.LanguageBidiRegionsSeparator) BidiRegionsSeparator(com.intellij.openapi.editor.bidi.BidiRegionsSeparator)

Aggregations

Language (com.intellij.lang.Language)1 BidiRegionsSeparator (com.intellij.openapi.editor.bidi.BidiRegionsSeparator)1 LanguageBidiRegionsSeparator (com.intellij.openapi.editor.bidi.LanguageBidiRegionsSeparator)1