String (@NotNull final XSourcePosition position) { final VirtualFile file = position.getFile(); return ReadAction.compute(() -> { final Document document = FileDocumentManager.getInstance().getDocument(file); final Project project = getSession().getProject(); if (document != null) { if (FileTypeRegistry.getInstance().isFileOfType(file, PythonFileType.INSTANCE)) { int breakpointLine = position.getLine(); if (breakpointLine < document.getLineCount()) { PsiElement psiElement = XDebuggerUtil.getInstance(). findContextElement(file, document.getLineStartOffset(breakpointLine), project, false); PyFunction function = PsiTreeUtil.getParentOfType(psiElement, PyFunction.class); if (function != null) { return function.getName(); } } } } return null; }); }