コード例 #1
0
        object IPreviewPaneService.GetPreviewPane(DiagnosticData data, IReadOnlyList <object> previewContent)
        {
            var title = data?.Message;

            if (string.IsNullOrWhiteSpace(title))
            {
                if (previewContent == null)
                {
                    // Bail out in cases where there is nothing to put in the header section
                    // of the preview pane and no preview content (i.e. no diff view) either.
                    return(null);
                }

                return(new PreviewPane(id: null, title: null, helpLink: null, helpLinkToolTipText: null, previewContent: previewContent));
            }
            else
            {
                if (previewContent == null)
                {
                    // TODO: Mac, if we have title but no content, we should still display title/help link...
                    return(null);
                }
            }

            var helpLinkUri     = BrowserHelper.GetHelpLink(data);
            var helpLinkToolTip = BrowserHelper.GetHelpLinkToolTip(data.Id, helpLinkUri);

            return(new PreviewPane(
                       id: data.Id, title: title,
                       helpLink: helpLinkUri,
                       helpLinkToolTipText: helpLinkToolTip,
                       previewContent: previewContent));
        }
コード例 #2
0
ファイル: PreviewPaneService.cs プロジェクト: belav/roslyn
        object IPreviewPaneService.GetPreviewPane(
            DiagnosticData data,
            IReadOnlyList <object> previewContent
            )
        {
            var title = data?.Message;

            if (string.IsNullOrWhiteSpace(title))
            {
                if (previewContent == null)
                {
                    // Bail out in cases where there is nothing to put in the header section
                    // of the preview pane and no preview content (i.e. no diff view) either.
                    return(null);
                }

                return(new PreviewPane(
                           severityIcon: null,
                           id: null,
                           title: null,
                           description: null,
                           helpLink: null,
                           helpLinkToolTipText: null,
                           previewContent: previewContent,
                           logIdVerbatimInTelemetry: false,
                           uiShell: _uiShell
                           ));
            }

            var helpLinkUri     = BrowserHelper.GetHelpLink(data);
            var helpLinkToolTip = BrowserHelper.GetHelpLinkToolTip(data.Id, helpLinkUri);

            Guid optionPageGuid = default;

            if (data.Properties.TryGetValue("OptionName", out var optionName))
            {
                data.Properties.TryGetValue("OptionLanguage", out var optionLanguage);
                optionPageGuid = GetOptionPageGuidForOptionName(optionName, optionLanguage);
            }

            return(new PreviewPane(
                       severityIcon: GetSeverityIconForDiagnostic(data),
                       id: data.Id,
                       title: title,
                       description: data.Description.ToString(CultureInfo.CurrentUICulture),
                       helpLink: helpLinkUri,
                       helpLinkToolTipText: helpLinkToolTip,
                       previewContent: previewContent,
                       logIdVerbatimInTelemetry: data.CustomTags.Contains(
                           WellKnownDiagnosticTags.Telemetry
                           ),
                       uiShell: _uiShell,
                       optionPageGuid: optionPageGuid
                       ));
        }
コード例 #3
0
        object IPreviewPaneService.GetPreviewPane(
            DiagnosticData data, IReadOnlyList <object> previewContent)
        {
            var title = data?.Message;

            if (string.IsNullOrWhiteSpace(title))
            {
                if (previewContent == null)
                {
                    // Bail out in cases where there is nothing to put in the header section
                    // of the preview pane and no preview content (i.e. no diff view) either.
                    return(null);
                }

                return(new PreviewPane(
                           severityIcon: null, id: null, title: null, description: null, helpLink: null, helpLinkToolTipText: null,
                           previewContent: previewContent, logIdVerbatimInTelemetry: false));
            }
            else
            {
                if (previewContent == null)
                {
                    // TODO: Mac, if we have title but no content, we should still display title/help link...
                    return(null);
                }
            }

            var helpLinkUri     = BrowserHelper.GetHelpLink(data);
            var helpLinkToolTip = BrowserHelper.GetHelpLinkToolTip(data.Id, helpLinkUri);

            Guid optionPageGuid = default;

            if (data.Properties.TryGetValue("OptionName", out _))
            {
                data.Properties.TryGetValue("OptionLanguage", out _);
                throw new NotImplementedException();
            }

            return(new PreviewPane(
                       severityIcon: null,//TODO: Mac GetSeverityIconForDiagnostic(diagnostic),
                       id: data.Id, title: title,
                       description: data.Description.ToString(CultureInfo.CurrentUICulture),
                       helpLink: helpLinkUri,
                       helpLinkToolTipText: helpLinkToolTip,
                       previewContent: previewContent,
                       logIdVerbatimInTelemetry: data.CustomTags.Contains(WellKnownDiagnosticTags.Telemetry),
                       optionPageGuid: optionPageGuid));
        }
                public override bool TryGetValue(int index, string columnName, [NotNullWhen(returnValue: true)] out object?content)
                {
                    // REVIEW: this method is too-chatty to make async, but otherwise, how one can implement it async?
                    //         also, what is cancellation mechanism?
                    var item = GetItem(index);

                    if (item == null)
                    {
                        content = null;
                        return(false);
                    }

                    var data = item.Data;

                    switch (columnName)
                    {
                    case StandardTableKeyNames.ErrorRank:
                        content = ValueTypeCache.GetOrCreate(GetErrorRank(data));
                        return(content != null);

                    case StandardTableKeyNames.ErrorSeverity:
                        content = ValueTypeCache.GetOrCreate(GetErrorCategory(data.Severity));
                        return(content != null);

                    case StandardTableKeyNames.ErrorCode:
                        content = data.Id;
                        return(content != null);

                    case StandardTableKeyNames.ErrorCodeToolTip:
                        content = BrowserHelper.GetHelpLinkToolTip(data);
                        return(content != null);

                    case StandardTableKeyNames.HelpKeyword:
                        content = data.Id;
                        return(content != null);

                    case StandardTableKeyNames.HelpLink:
                        content = BrowserHelper.GetHelpLink(data)?.AbsoluteUri;
                        return(content != null);

                    case StandardTableKeyNames.ErrorCategory:
                        content = data.Category;
                        return(content != null);

                    case StandardTableKeyNames.ErrorSource:
                        content = ValueTypeCache.GetOrCreate(GetErrorSource(_source.BuildTool));
                        return(content != null);

                    case StandardTableKeyNames.BuildTool:
                        content = GetBuildTool(_source.BuildTool);
                        return(content != null);

                    case StandardTableKeyNames.Text:
                        content = data.Message;
                        return(content != null);

                    case StandardTableKeyNames.DocumentName:
                        content = data.DataLocation?.GetFilePath();
                        return(content != null);

                    case StandardTableKeyNames.Line:
                        content = data.DataLocation?.MappedStartLine ?? 0;
                        return(true);

                    case StandardTableKeyNames.Column:
                        content = data.DataLocation?.MappedStartColumn ?? 0;
                        return(true);

                    case StandardTableKeyNames.ProjectName:
                        content = item.ProjectName;
                        return(content != null);

                    case ProjectNames:
                        var names = item.ProjectNames;
                        content = names;
                        return(names.Length > 0);

                    case StandardTableKeyNames.ProjectGuid:
                        content = ValueTypeCache.GetOrCreate(item.ProjectGuid);
                        return((Guid)content != Guid.Empty);

                    case ProjectGuids:
                        var guids = item.ProjectGuids;
                        content = guids;
                        return(guids.Length > 0);

                    case StandardTableKeyNames.SuppressionState:
                        content = data.IsSuppressed ? SuppressionState.Suppressed : SuppressionState.Active;
                        return(true);

                    default:
                        content = null;
                        return(false);
                    }
                }
コード例 #5
0
                    public override bool TryGetValue(int index, string columnName, out object content)
                    {
                        // REVIEW: this method is too-chatty to make async, but otherwise, how one can implement it async?
                        //         also, what is cancellation mechanism?
                        var item = GetItem(index);

                        if (item == null)
                        {
                            content = null;
                            return(false);
                        }

                        var data = item.Data;

                        switch (columnName)
                        {
                        case StandardTableKeyNames.ErrorRank:
                            // build error gets highest rank
                            content = ValueTypeCache.GetOrCreate(ErrorRank.Lexical);
                            return(content != null);

                        case StandardTableKeyNames.ErrorSeverity:
                            content = ValueTypeCache.GetOrCreate(GetErrorCategory(data.Severity));
                            return(content != null);

                        case StandardTableKeyNames.ErrorCode:
                            content = data.Id;
                            return(content != null);

                        case StandardTableKeyNames.ErrorCodeToolTip:
                            content = BrowserHelper.GetHelpLinkToolTip(data);
                            return(content != null);

                        case StandardTableKeyNames.HelpKeyword:
                            content = data.Id;
                            return(content != null);

                        case StandardTableKeyNames.HelpLink:
                            content = BrowserHelper.GetHelpLink(data)?.AbsoluteUri;
                            return(content != null);

                        case StandardTableKeyNames.ErrorCategory:
                            content = data.Category;
                            return(content != null);

                        case StandardTableKeyNames.ErrorSource:
                            content = ValueTypeCache.GetOrCreate(ErrorSource.Build);
                            return(content != null);

                        case StandardTableKeyNames.BuildTool:
                            content = _source.BuildTool;
                            return(content != null);

                        case StandardTableKeyNames.Text:
                            content = data.Message;
                            return(content != null);

                        case StandardTableKeyNames.DocumentName:
                            content = GetFileName(data.DataLocation?.OriginalFilePath, data.DataLocation?.MappedFilePath);
                            return(content != null);

                        case StandardTableKeyNames.Line:
                            content = data.DataLocation?.MappedStartLine ?? 0;
                            return(true);

                        case StandardTableKeyNames.Column:
                            content = data.DataLocation?.MappedStartColumn ?? 0;
                            return(true);

                        case StandardTableKeyNames.ProjectName:
                            content = item.ProjectName;
                            return(content != null);

                        case ProjectNames:
                            var names = item.ProjectNames;
                            content = names;
                            return(names.Length > 0);

                        case StandardTableKeyNames.ProjectGuid:
                            content = ValueTypeCache.GetOrCreate(item.ProjectGuid);
                            return((Guid)content != Guid.Empty);

                        case ProjectGuids:
                            var guids = item.ProjectGuids;
                            content = guids;
                            return(guids.Length > 0);

                        case StandardTableKeyNames.SuppressionState:
                            // Build doesn't support suppression.
                            Contract.ThrowIfTrue(data.IsSuppressed);
                            content = SuppressionState.NotApplicable;
                            return(true);

                        default:
                            content = null;
                            return(false);
                        }
                    }