Processor<PsiLanguageInjectionHost> (@NotNull final Project project, @NotNull final String languageId) { return host -> { if (host == null) return false; final Configuration.AdvancedConfiguration configuration = Configuration.getProjectInstance(project).getAdvancedConfiguration(); boolean allowed = configuration.isSourceModificationAllowed(); configuration.setSourceModificationAllowed(true); try { return doInject(languageId, host, host); } finally { configuration.setSourceModificationAllowed(allowed); } }; }