EnumSet<RegExpCapability> (PsiElement psi, @NotNull EnumSet<RegExpCapability> capabilities) { PsiElement host = InjectedLanguageUtil.findInjectionHost(psi); if (host == null && !(psi instanceof PsiFile)) host = psi.getParent(); Language language = host == null ? null : host.getLanguage(); RegExpCapabilitiesProvider provider = language == null ? null : RegExpCapabilitiesProvider.EP.forLanguage(language); return provider == null ? capabilities : EnumSet.copyOf(provider.setup(host, capabilities)); }