Result (Expression @NotNull [] params, ExpressionContext context) { PsiElement place = context.getPsiElementAtStartOffset(); PyFunction pyFunction = PsiTreeUtil.getParentOfType(place, PyFunction.class); if (pyFunction == null) { return null; } String name = pyFunction.getName(); return name == null ? null : new TextResult(name); }