void (@NotNull Project project, @NotNull ProblemDescriptor descriptor) { PsiElement element = descriptor.getPsiElement(); Ref<Boolean> hadComma = Ref.create(false); VirtualFile file = element.getContainingFile().getVirtualFile(); PsiElement newElement = performFix(element, hadComma); // if we have more than one property, don't expand templates and don't move the caret if (newElement == null) return; PsiElement value = myQuickFixAdapter.getPropertyValue(newElement); FileEditor fileEditor = FileEditorManager.getInstance(project).getSelectedEditor(file); Editor editor = fileEditor instanceof TextEditor ? ((TextEditor)fileEditor).getEditor() : null; assert editor != null; if (value == null) { WriteAction.run(() -> editor.getCaretModel().moveToOffset(newElement.getTextRange().getEndOffset())); return; } PsiDocumentManager.getInstance(project).doPostponedOperationsAndUnblockDocument(editor.getDocument()); TemplateManager templateManager = TemplateManager.getInstance(project); TemplateBuilderImpl builder = new TemplateBuilderImpl(newElement); String text = value.getText(); boolean isEmptyArray = StringUtil.equalsIgnoreWhitespaces(text, "[]"); boolean isEmptyObject = StringUtil.equalsIgnoreWhitespaces(text, "{}"); boolean goInside = isEmptyArray || isEmptyObject || StringUtil.isQuotedString(text); TextRange range = goInside ? TextRange.create(1, text.length() - 1) : TextRange.create(0, text.length()); builder.replaceElement(value, range, myData.myMissingPropertyIssues.iterator().next().enumItemsCount > 1 || isEmptyObject ? new MacroCallNode(new CompleteMacro()) : isEmptyArray ? new EmptyNode() : new ConstantNode(goInside ? StringUtil.unquoteString(text) : text)); editor.getCaretModel().moveToOffset(newElement.getTextRange().getStartOffset()); if (PsiTreeUtil.nextLeaf(newElement) != null) { builder.setEndVariableAfter(newElement); } else { builder.setEndVariableBefore(newElement.getLastChild()); } WriteAction.run(() -> { Template template = builder.buildInlineTemplate(); template.setToReformat(true); templateManager.startTemplate(editor, template); }); }