long (@NotNull Editor editor, @Nullable PsiElement psiElement) { if (psiElement == null) { return -1; } Document document = editor.getDocument(); TextRange range = psiElement.getTextRange(); if (range == null) { return -1; } return document.getLineNumber(range.getStartOffset()); }