ContextDescriptor (@NotNull PsiElement element, boolean calculateInjectionDescriptor) { PsiFile file = element.getContainingFile(); if (file == null) return null; FileViewProvider provider = file.getViewProvider(); PsiLanguageInjectionHost injectionHost = InjectedLanguageManager.getInstance(element.getProject()).getInjectionHost(element); ContextDescriptor injectionDescriptor = calculateInjectionDescriptor && injectionHost != null ? from(injectionHost, false) : null; return new ContextDescriptor(element.getLanguage(), provider.getBaseLanguage(), provider.getLanguages(), injectionDescriptor); }