PsiElement (PsiElement expression, PyAssignmentStatement declaration) { PyFunction function = PsiTreeUtil.getParentOfType(expression, PyFunction.class); if (function != null && declaration != null) { PyParameterList parameterList = function.getParameterList(); parameterList.addParameter(PyElementGenerator.getInstance(function.getProject()).createParameter(declaration.getText())); CodeInsightUtilCore.forcePsiPostprocessAndRestoreElement(function); return parameterList.findParameterByName(declaration.getTargets()[0].getText()); } return null; }