PsiVariable (String[] names, PsiType psiType) { PsiVariable variable = introduceVariable(); if (variable instanceof PsiLocalVariable) { PsiLambdaExpression lambda = WriteAction .compute(() -> ChainCallExtractor.extractMappingStep(myProject, (PsiLocalVariable)variable)); if (lambda != null) { PsiParameter parameter = Objects.requireNonNull(ArrayUtil.getFirstElement(lambda.getParameterList().getParameters())); myParameter = parameter; myBlock = PsiTreeUtil.getParentOfType(lambda, PsiCodeBlock.class, PsiLambdaExpression.class, PsiMember.class); myExprMarker = null; myExpr = null; myOccurrences = StreamEx.of(ReferencesSearch.search(parameter).findAll()).map(PsiReference::getElement).select(PsiExpression.class) .toArray(PsiExpression[]::new); myOccurrenceMarkers = null; final PsiIdentifier identifier = variable.getNameIdentifier(); if (identifier != null) { myEditor.getCaretModel().moveToOffset(identifier.getTextOffset()); } setAdvertisementText(null); PsiDocumentManager.getInstance(myProject).doPostponedOperationsAndUnblockDocument(myEditor.getDocument()); initOccurrencesMarkers(); return parameter; } else if (!variable.isValid()) { return null; } } return variable; }