public object Create(IAnalysisIssueBase analysisIssueBase) { var ruleUrl = ruleHelpLinkProvider.GetHelpLink(analysisIssueBase.RuleKey); var hyperLink = new Hyperlink { Inlines = { analysisIssueBase.RuleKey }, Foreground = GetVsThemedColor(EnvironmentColors.ControlLinkTextColorKey), TextDecorations = null, Command = new DelegateCommand(o => browserService.Navigate(ruleUrl)) }; var content = new TextBlock { Inlines = { hyperLink, ": ", analysisIssueBase.Message }, Foreground = GetVsThemedColor(EnvironmentColors.SystemCaptionTextBrushKey) }; return(content); }
public void ShowRuleDescription(string ruleKey) { var helpLink = ruleHelpLinkProvider.GetHelpLink(ruleKey); vsBrowserService.Navigate(helpLink); }
public override bool TryGetValue(int index, string keyName, out object content) { if (index < 0 || index >= issues.Count || ShouldHideIssue(issues[index])) { content = null; return(false); } var issueViz = issues[index]; var issue = issueViz.Issue as IAnalysisIssue; switch (keyName) { case StandardTableKeyNames.DocumentName: content = AnalyzedFilePath; return(true); case StandardTableKeyNames.Line: // Note: the line and column numbers are taken from the SnapshotSpan, not the Issue. // The SnapshotSpan represents the live document, so the text positions could have // changed from those reported from the Issue. content = issueViz.Span.Value.Start.GetContainingLine().LineNumber; return(true); case StandardTableKeyNames.Column: // Use the span, not the issue. See comment immediately above. var position = issueViz.Span.Value.Start; var line = position.GetContainingLine(); content = position.Position - line.Start.Position; return(true); case StandardTableKeyNames.Text: content = issue.Message; return(true); case StandardTableKeyNames.ErrorSeverity: content = toVsSeverityConverter.Convert(issue.Severity); return(true); case StandardTableKeyNames.BuildTool: content = "SonarLint"; return(true); case StandardTableKeyNames.ErrorCode: content = issue.RuleKey; return(true); case StandardTableKeyNames.ErrorRank: content = ErrorRank.Other; return(true); case StandardTableKeyNames.ErrorCategory: content = $"{issue.Severity} {ToString(issue.Type)}"; return(true); case StandardTableKeyNames.ErrorCodeToolTip: content = $"Open description of rule {issue.RuleKey}"; return(true); case StandardTableKeyNames.HelpLink: string ruleKey = issue.RuleKey; content = ruleHelpLinkProvider.GetHelpLink(ruleKey); return(true); case StandardTableKeyNames.ProjectName: content = projectName; return(true); case StandardTableKeyNames.ProjectGuid: content = projectGuid; return(true); // Not a visible field - returns the issue object case SonarLintTableControlConstants.IssueVizColumnName: content = issueViz; return(true); default: content = null; return(false); } }