void (@NonNls final String bytecode, PsiElement element, int lineNumber) { int offset = -1; VirtualFile file = PsiUtilCore.getVirtualFile(element); if (file != null) { final Document document = FileDocumentManager.getInstance().getDocument(file); if (document != null) { if (lineNumber == -1) { lineNumber = document.getLineNumber(element.getTextOffset()); } // Use 1-based line numbers from here: lineNumber++; LineNumbersMapping mapping = file.getUserData(LineNumbersMapping.LINE_NUMBERS_MAPPING_KEY); if (mapping != null) { for (int l = lineNumber; l <= document.getLineCount(); l++) { int bytecodeLine = mapping.sourceToBytecode(l); if (bytecodeLine != -1) { offset = findLineNumber(bytecode, bytecodeLine); assert offset != -1 : "there is bytecode line in mapping but it is missing in bytecode"; break; } } } else { for (int l = lineNumber; l <= document.getLineCount(); l++) { offset = findLineNumber(bytecode, l); if (offset != -1) { break; } } } } } setText(bytecode, Math.max(0, offset)); }