void (final PsiLanguageInjectionHost host, final InjectedLanguage language) { InjectedLanguage prevLanguage = host.getUserData(LanguageInjectionSupport.TEMPORARY_INJECTED_LANGUAGE); SmartPsiElementPointer<PsiLanguageInjectionHost> pointer = SmartPointerManager.getInstance(myProject).createSmartPsiElementPointer(host); TempPlace prevPlace = new TempPlace(prevLanguage, pointer); TempPlace place = new TempPlace(language, pointer); Configuration.replaceInjectionsWithUndo( myProject, host.getContainingFile(), place, prevPlace, false, Collections.emptyList(), (add, remove) -> { addInjectionPlace(add); return true; }); }