protected void AssertHelper(string xmlDocId, Action <CodeAnnotationsCache, IDeclaredElement> assert) { WithSingleProject(EmptyList <string> .InstanceList, (lifetime, solution, project) => RunGuarded(() => { var psiModule = solution.PsiModules().GetPrimaryPsiModule(project, TargetFrameworkId.Default); var psiServices = solution.GetPsiServices(); var declaredElement = XMLDocUtil.ResolveId(psiServices, xmlDocId, psiModule, true, project.GetResolveContext()); Assert.NotNull(declaredElement, "Declared element cannot be resolved from XML Doc ID {0}", xmlDocId); var annotationsCache = psiServices.GetCodeAnnotationsCache(); assert(annotationsCache, declaredElement); })); }
public static JetBrains.UI.RichText.RichText ProcessCRef(string crefValue, PsiLanguageType languageType, IPsiModule psiModule, DeclaredElementPresenterStyle presenterStyle) { var element = psiModule == null ? null : XMLDocUtil.ResolveId(psiModule.GetPsiServices(), crefValue, psiModule, true); return(element == null || !element.IsValid() ? new JetBrains.UI.RichText.RichText(XmlDocPresenterUtil.ProcessCref(crefValue), XmlDocRichTextPresenterEx.ourCRefStyle) : DeclaredElementPresenter.Format(languageType, presenterStyle, element)); }