/// <summary> /// Get hover content for an <see cref="MSBuildImport"/>. /// </summary> /// <param name="unresolvedImport"> /// The <see cref="MSBuildImport"/>. /// </param> /// <returns> /// The content, or <c>null</c> if no content is provided. /// </returns> public MarkedStringContainer UnresolvedImport(MSBuildUnresolvedImport unresolvedImport) { if (unresolvedImport == null) { throw new ArgumentNullException(nameof(unresolvedImport)); } string condition = unresolvedImport.Condition; string evaluatedCondition = _projectDocument.MSBuildProject.ExpandString(condition); string project = unresolvedImport.Project; string evaluatedProject = _projectDocument.MSBuildProject.ExpandString(project); StringBuilder descriptionContent = new StringBuilder(); descriptionContent.AppendLine( $"Project: `{project}`" ); descriptionContent.AppendLine(); descriptionContent.AppendLine( $"Evaluated Project: `{evaluatedProject}`" ); descriptionContent.AppendLine(); descriptionContent.AppendLine( $"Condition: `{condition}`" ); descriptionContent.AppendLine(); descriptionContent.AppendLine( $"Evaluated Condition: `{evaluatedCondition}`" ); List <MarkedString> content = new List <MarkedString> { "Unresolved Import (condition is false)", descriptionContent.ToString() }; string helpLink = MSBuildSchemaHelp.HelpLinkForElement(unresolvedImport.Element.Name); if (!String.IsNullOrWhiteSpace(helpLink)) { content.Add( $"[Help]({helpLink})" ); } return(new MarkedStringContainer(content)); }
/// <summary> /// Get hover content for an <see cref="MSBuildImport"/>. /// </summary> /// <param name="unresolvedImport"> /// The <see cref="MSBuildImport"/>. /// </param> /// <returns> /// The content, or <c>null</c> if no content is provided. /// </returns> public MarkedStringContainer UnresolvedImport(MSBuildUnresolvedImport unresolvedImport) { if (unresolvedImport == null) { throw new ArgumentNullException(nameof(unresolvedImport)); } string condition = unresolvedImport.Condition; string evaluatedCondition = _projectDocument.MSBuildProject.ExpandString(condition); string project = unresolvedImport.Project; string evaluatedProject = _projectDocument.MSBuildProject.ExpandString(project); StringBuilder descriptionContent = new StringBuilder(); descriptionContent.AppendLine( $"Project: `{project}`" ); descriptionContent.AppendLine(); descriptionContent.AppendLine( $"Evaluated Project: `{evaluatedProject}`" ); descriptionContent.AppendLine(); descriptionContent.AppendLine( $"Condition: `{condition}`" ); descriptionContent.AppendLine(); descriptionContent.AppendLine( $"Evaluated Condition: `{evaluatedCondition}`" ); return(new MarkedStringContainer( $"Unresolved Import (condition is false)", descriptionContent.ToString() )); }