int (final PsiFile psiFile) { // TODO: harmonize with CythonResolveTest synax // TODO: check and fix work with single letter identifiers Document document = PsiDocumentManager.getInstance(psiFile.getProject()).getDocument(psiFile); assert document != null; int offset = -1; for (int i = 1; i < document.getLineCount(); i++) { int lineStart = document.getLineStartOffset(i); int lineEnd = document.getLineEndOffset(i); final int index = document.getCharsSequence().subSequence(lineStart, lineEnd).toString().indexOf("<ref>"); if (index > 0) { offset = document.getLineStartOffset(i - 1) + index; } } assertTrue("<ref> in test file not found", offset >= 0); return offset; }