List<TextRange> (@NotNull final PsiElement e, @NotNull final CharSequence editorText, final int cursorOffset, @NotNull final Editor editor) { PsiElement endElement = e; while(endElement.getLastChild() != null) { endElement = endElement.getLastChild(); } if (endElement instanceof PsiWhiteSpace) { final PsiElement prevSibling = endElement.getPrevSibling(); if (prevSibling != null) { endElement = prevSibling; } } return new ArrayList<>(expandToWholeLine(editorText, new TextRange(e.getTextRange().getStartOffset(), endElement.getTextRange().getEndOffset()))); }