@Override
  public List<TextRange> select(@NotNull PsiElement e, @NotNull CharSequence editorText, int cursorOffset, @NotNull Editor editor) {
    final TextRange originalRange;
    if (e instanceof PsiWhiteSpace) {
      TextRange whiteSpaceRange = expandToWhiteSpace(e, cursorOffset);
      if (whiteSpaceRange == null) return null;
      originalRange = whiteSpaceRange;
    } else if (e instanceof PsiPlainText) {
      TextRange whiteSpaceRange = expandToWhiteSpace(e, cursorOffset);
      originalRange = whiteSpaceRange == null ? e.getTextRange() : whiteSpaceRange;
    } else {
      originalRange = e.getTextRange();
    }

    if (originalRange.getEndOffset() > editorText.length()) {
      throw new RuntimeExceptionWithAttachments(
        "Invalid element range in " + getClass(),
        "element=" + e + "; range=" + originalRange + "; text length=" + editorText.length() + "; editor=" + editor +
        "; committed=" + PsiDocumentManager.getInstance(e.getProject()).isCommitted(editor.getDocument()),
        new Attachment("editor_text.txt", editorText.toString()),
        new Attachment("psi_text.txt", e.getText()));
    }

    List<TextRange> ranges = expandToWholeLine(editorText, originalRange, true);

    if (ranges.size() == 1 && ranges.contains(originalRange)) {
      return expandToWholeLine(editorText, originalRange, false);
    }

    return ranges;
  }
@Override
  public List<TextRange> select(@NotNull PsiElement e, @NotNull CharSequence editorText, int cursorOffset, @NotNull Editor editor)