@Nullable
  private static TextRange getExpandedRange(@NotNull CharSequence text, @NotNull TextRange range, boolean isSymmetric) {
    int startOffset = range.getStartOffset();
    int endOffset = range.getEndOffset();
    int index1 = CharArrayUtil.shiftBackward(text, startOffset - 1, " \t");
    if (endOffset > startOffset && text.charAt(endOffset - 1) == '\n') {
      endOffset--;
    }
    int textLength = text.length();
    int index2 = Math.min(textLength, CharArrayUtil.shiftForward(text, endOffset, " \t"));

    if (index1 < 0 || text.charAt(index1) == '\n' || index2 == textLength || text.charAt(index2) == '\n') {
      if (!isSymmetric) {
        if (index1 < 0 || text.charAt(index1) == '\n') {
          startOffset = index1 + 1;
        }

        if (index2 == textLength || text.charAt(index2) == '\n') {
          endOffset = index2;
          if (endOffset < textLength) {
            endOffset++;
          }
        }

        return new TextRange(startOffset, endOffset);
      }

      if ((index1 < 0 || text.charAt(index1) == '\n') &&
          (index2 == textLength || text.charAt(index2) == '\n')) {
        startOffset = index1 + 1;
        endOffset = index2;
        if (endOffset < textLength) {
          endOffset++;
        }
        return new TextRange(startOffset, endOffset);
      }
    }

    return null;
  }
@Nullable
  private static TextRange getExpandedRange(@NotNull CharSequence text, @NotNull TextRange range, boolean isSymmetric)