protected static int getElementLine(@Nullable PsiElement element, @NotNull Editor editor, boolean first) {
        if (element == null) return -1;

        Document doc = editor.getDocument();
        TextRange spaceRange = element.getTextRange();

        return first ? doc.getLineNumber(spaceRange.getStartOffset()) : doc.getLineNumber(spaceRange.getEndOffset());
    }
protected static int getElementLine(@Nullable PsiElement element, @NotNull Editor editor, boolean first)