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:
                        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 = GetHelpLinkToolTipText(item.Workspace, data);
                        return(content != null);

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

                    case StandardTableKeyNames.HelpLink:
                        content = GetHelpLink(item.Workspace, data);
                        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 = 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:
                        content = data.IsSuppressed ? SuppressionState.Suppressed : SuppressionState.Active;
                        return(true);

                    default:
                        content = null;
                        return(false);
                    }
                }
예제 #2
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);

                    var data = item?.Primary;

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

                    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 = GetHelpLinkToolTipText(data);
                        return(content != null);

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

                    case StandardTableKeyNames.HelpLink:
                        content = GetHelpLink(data);
                        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:
                        content = item.ProjectNames;
                        return(((string[])content).Length > 0);

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

                    case ProjectGuids:
                        content = item.ProjectGuids;
                        return(((Guid[])content).Length > 0);

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

                    default:
                        content = null;
                        return(false);
                    }
                }
예제 #3
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);

                    var data = item?.Primary;

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

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

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

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

                    case StandardTableKeyNames.Line:
                        content = GetLineColumn(data).Line;
                        return(true);

                    case StandardTableKeyNames.Column:
                        content = GetLineColumn(data).Character;
                        return(true);

                    case StandardTableKeyNames.TaskCategory:
                        content = ValueTypeCache.GetOrCreate(VSTASKCATEGORY.CAT_COMMENTS);
                        return(content != null);

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

                    case ProjectNames:
                        content = item.ProjectNames;
                        return(((string[])content).Length > 0);

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

                    case ProjectGuids:
                        content = item.ProjectGuids;
                        return(((Guid[])content).Length > 0);

                    default:
                        content = null;
                        return(false);
                    }
                }
예제 #4
0
                    public override bool TryGetValue(int index, string columnName, [NotNullWhen(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:
                            // 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 = (data.GetValidHelpLinkUri() != null) ? string.Format(EditorFeaturesResources.Get_help_for_0, data.Id) : null;
                            return(content != null);

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

                        case StandardTableKeyNames.HelpLink:
                            content = data.GetValidHelpLinkUri()?.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 = 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:
                            // Build doesn't support suppression.
                            Contract.ThrowIfTrue(data.IsSuppressed);
                            content = SuppressionState.NotApplicable;
                            return(true);

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