boolean (final PsiLanguageInjectionHost host) { Set<String> languages = new HashSet<>(); List<Pair<PsiElement, TextRange>> files = InjectedLanguageManager.getInstance(host.getProject()).getInjectedPsiFiles(host); if (files == null) return false; for (Pair<PsiElement, TextRange> pair : files) { for (Language lang = pair.first.getLanguage(); lang != null; lang = lang.getBaseLanguage()) { languages.add(lang.getID()); } } // todo there is a problem: host i.e. literal expression is confused with "target" i.e. parameter // todo therefore this part doesn't work for java return Configuration.getProjectInstance(host.getProject()).setHostInjectionEnabled(host, languages, false); }