boolean (final Project project, final PsiLanguageInjectionHost host) { InjectedLanguage prevLanguage = host.getUserData(LanguageInjectionSupport.TEMPORARY_INJECTED_LANGUAGE); if (prevLanguage == null) return false; SmartPointerManager manager = SmartPointerManager.getInstance(myProject); SmartPsiElementPointer<PsiLanguageInjectionHost> pointer = manager.createSmartPsiElementPointer(host); TempPlace place = new TempPlace(prevLanguage, pointer); TempPlace nextPlace = new TempPlace(null, pointer); Configuration.replaceInjectionsWithUndo( project, host.getContainingFile(), nextPlace, place, false, Collections.emptyList(), (add, remove) -> { addInjectionPlace(add); return true; }); return true; }