void (@NotNull Project project, @NotNull Editor editor, @NotNull PsiFile file, @NotNull Injectable injectable, @NotNull FixPresenter fixPresenter) { PsiLanguageInjectionHost host = findInjectionHost(editor, file); if (host == null) return; if (defaultFunctionalityWorked(host, injectable.getId())) return; try { host.putUserData(FIX_KEY, null); Language language = injectable.toLanguage(); for (LanguageInjectionSupport support : InjectorUtils.getActiveInjectionSupports()) { if (support.isApplicableTo(host) && support.addInjectionInPlace(language, host)) { return; } } if (TemporaryPlacesRegistry.getInstance(project).getLanguageInjectionSupport().addInjectionInPlace(language, host)) { Processor<? super PsiLanguageInjectionHost> fixer = host.getUserData(FIX_KEY); String text = IntelliLangBundle.message("intelliLang.temporary.injected", StringUtil.escapeXmlEntities(language.getDisplayName())); if (fixer != null) { SmartPsiElementPointer<PsiLanguageInjectionHost> pointer = SmartPointerManager.getInstance(project).createSmartPsiElementPointer(host); String fixText = text + "<br>" + ((fixer instanceof MyFixAction) ? ((MyFixAction)fixer).getText() : IntelliLangBundle.message("intelliLang.suggest.insert.annotation")) + " " + KeymapUtil.getFirstKeyboardShortcutText(ActionManager.getInstance().getAction(IdeActions.ACTION_SHOW_INTENTION_ACTIONS)); fixPresenter.showFix(editor, host.getTextRange(), pointer, fixText, host1 -> { List<Pair<PsiElement, TextRange>> files = InjectedLanguageManager.getInstance(project).getInjectedPsiFiles(host1); if (files != null) { for (Pair<PsiElement, TextRange> pair: files) { PsiFile psiFile = (PsiFile)pair.first; LanguageInjectionSupport languageInjectionSupport = psiFile.getUserData(LanguageInjectionSupport.INJECTOR_SUPPORT); if (languageInjectionSupport != null) { languageInjectionSupport.removeInjectionInPlace(host1); } } } else { LanguageInjectionSupport support = host1.getUserData(LanguageInjectionSupport.INJECTOR_SUPPORT); if (support != null) { if (support.removeInjection(host)) { host1.getManager().dropPsiCaches(); } } } return fixer.process(host1); }); } else { HintManager.getInstance().showInformationHint(editor, text); } } } finally { if (injectable.getLanguage() != null) { // no need for reference injection FileContentUtil.reparseFiles(project, Collections.emptyList(), true); } else { PsiManager.getInstance(project).dropPsiCaches(); } } }