From c632be8ea39b1b512b827775fdbbf8075ccbd1ae Mon Sep 17 00:00:00 2001 From: Heejae Chang Date: Wed, 23 Mar 2016 13:42:25 -0700 Subject: [PATCH] made solution to compile without v1 engine. --- .../DiagnosticAnalyzerCategory.cs | 0 ...agnosticIncrementalAnalyzer.NestedTypes.cs | 25 ++------------ .../EngineV2/DiagnosticIncrementalAnalyzer.cs | 2 ++ .../Diagnostics/LiveDiagnosticUpdateArgsId.cs | 34 +++++++++++++++++++ src/Features/Core/Portable/Features.csproj | 34 ++++++++++--------- ...DiagnosticListTable.LiveTableDataSource.cs | 6 ++-- .../VisualStudioBaseDiagnosticListTable.cs | 10 +++--- 7 files changed, 65 insertions(+), 46 deletions(-) rename src/Features/Core/Portable/Diagnostics/{EngineV1 => }/DiagnosticAnalyzerCategory.cs (100%) create mode 100644 src/Features/Core/Portable/Diagnostics/LiveDiagnosticUpdateArgsId.cs diff --git a/src/Features/Core/Portable/Diagnostics/EngineV1/DiagnosticAnalyzerCategory.cs b/src/Features/Core/Portable/Diagnostics/DiagnosticAnalyzerCategory.cs similarity index 100% rename from src/Features/Core/Portable/Diagnostics/EngineV1/DiagnosticAnalyzerCategory.cs rename to src/Features/Core/Portable/Diagnostics/DiagnosticAnalyzerCategory.cs diff --git a/src/Features/Core/Portable/Diagnostics/EngineV1/DiagnosticIncrementalAnalyzer.NestedTypes.cs b/src/Features/Core/Portable/Diagnostics/EngineV1/DiagnosticIncrementalAnalyzer.NestedTypes.cs index dbec975cdf9..4e7508b38ad 100644 --- a/src/Features/Core/Portable/Diagnostics/EngineV1/DiagnosticIncrementalAnalyzer.NestedTypes.cs +++ b/src/Features/Core/Portable/Diagnostics/EngineV1/DiagnosticIncrementalAnalyzer.NestedTypes.cs @@ -102,32 +102,13 @@ public override string BuildTool } } - public class ArgumentKey : AnalyzerUpdateArgsId + public class ArgumentKey : LiveDiagnosticUpdateArgsId { - public readonly StateType StateType; - public readonly object Key; - - public ArgumentKey(DiagnosticAnalyzer analyzer, StateType stateType, object key) : base(analyzer) + public ArgumentKey(DiagnosticAnalyzer analyzer, StateType stateType, object key) : base(analyzer, key, (int)stateType) { - StateType = stateType; - Key = key; } - public override bool Equals(object obj) - { - var other = obj as ArgumentKey; - if (other == null) - { - return false; - } - - return StateType == other.StateType && Equals(Key, other.Key) && base.Equals(obj); - } - - public override int GetHashCode() - { - return Hash.Combine(Key, Hash.Combine((int)StateType, base.GetHashCode())); - } + public StateType StateType => (StateType)Kind; } } } diff --git a/src/Features/Core/Portable/Diagnostics/EngineV2/DiagnosticIncrementalAnalyzer.cs b/src/Features/Core/Portable/Diagnostics/EngineV2/DiagnosticIncrementalAnalyzer.cs index 2a441b30194..50bbf3ab086 100644 --- a/src/Features/Core/Portable/Diagnostics/EngineV2/DiagnosticIncrementalAnalyzer.cs +++ b/src/Features/Core/Portable/Diagnostics/EngineV2/DiagnosticIncrementalAnalyzer.cs @@ -1,5 +1,6 @@ // Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +using System; using System.Collections.Generic; using System.Collections.Immutable; using System.Linq; @@ -7,6 +8,7 @@ using System.Threading.Tasks; using Microsoft.CodeAnalysis.Shared.Extensions; using Microsoft.CodeAnalysis.Shared.Options; +using Microsoft.CodeAnalysis.Text; using Roslyn.Utilities; namespace Microsoft.CodeAnalysis.Diagnostics.EngineV2 diff --git a/src/Features/Core/Portable/Diagnostics/LiveDiagnosticUpdateArgsId.cs b/src/Features/Core/Portable/Diagnostics/LiveDiagnosticUpdateArgsId.cs new file mode 100644 index 00000000000..bfb512a7f34 --- /dev/null +++ b/src/Features/Core/Portable/Diagnostics/LiveDiagnosticUpdateArgsId.cs @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using Roslyn.Utilities; + +namespace Microsoft.CodeAnalysis.Diagnostics +{ + internal class LiveDiagnosticUpdateArgsId : AnalyzerUpdateArgsId + { + public readonly object Key; + public readonly int Kind; + + public LiveDiagnosticUpdateArgsId(DiagnosticAnalyzer analyzer, object key, int kind) : base(analyzer) + { + Key = key; + Kind = kind; + } + + public override bool Equals(object obj) + { + var other = obj as LiveDiagnosticUpdateArgsId; + if (other == null) + { + return false; + } + + return Kind == other.Kind && Equals(Key, other.Key) && base.Equals(obj); + } + + public override int GetHashCode() + { + return Hash.Combine(Key, Hash.Combine(Kind, base.GetHashCode())); + } + } +} diff --git a/src/Features/Core/Portable/Features.csproj b/src/Features/Core/Portable/Features.csproj index 5ef6049b915..4329b0d0622 100644 --- a/src/Features/Core/Portable/Features.csproj +++ b/src/Features/Core/Portable/Features.csproj @@ -182,9 +182,26 @@ + + + + + + + + + + + + + + + + + @@ -197,13 +214,6 @@ - - - - - - - @@ -218,10 +228,6 @@ - - - - @@ -283,11 +289,6 @@ - - - - - @@ -577,6 +578,7 @@ + diff --git a/src/VisualStudio/Core/Def/Implementation/TableDataSource/VisualStudioBaseDiagnosticListTable.LiveTableDataSource.cs b/src/VisualStudio/Core/Def/Implementation/TableDataSource/VisualStudioBaseDiagnosticListTable.LiveTableDataSource.cs index e6d4be18053..3f2310c091a 100644 --- a/src/VisualStudio/Core/Def/Implementation/TableDataSource/VisualStudioBaseDiagnosticListTable.LiveTableDataSource.cs +++ b/src/VisualStudio/Core/Def/Implementation/TableDataSource/VisualStudioBaseDiagnosticListTable.LiveTableDataSource.cs @@ -123,14 +123,14 @@ private object CreateAggregationKey(object data) return GetItemKey(data); } - var argumentKey = args.Id as DiagnosticIncrementalAnalyzer.ArgumentKey; - if (argumentKey == null) + var liveArgsId = args.Id as LiveDiagnosticUpdateArgsId; + if (liveArgsId == null) { return GetItemKey(data); } var documents = args.Solution.GetRelatedDocumentIds(args.DocumentId); - return new AggregatedKey(documents, argumentKey.Analyzer, argumentKey.StateType); + return new AggregatedKey(documents, liveArgsId.Analyzer, liveArgsId.Kind); } private void PopulateInitialData(Workspace workspace, IDiagnosticService diagnosticService) diff --git a/src/VisualStudio/Core/Def/Implementation/TableDataSource/VisualStudioBaseDiagnosticListTable.cs b/src/VisualStudio/Core/Def/Implementation/TableDataSource/VisualStudioBaseDiagnosticListTable.cs index 13f534a75e5..6fbe30e97d6 100644 --- a/src/VisualStudio/Core/Def/Implementation/TableDataSource/VisualStudioBaseDiagnosticListTable.cs +++ b/src/VisualStudio/Core/Def/Implementation/TableDataSource/VisualStudioBaseDiagnosticListTable.cs @@ -104,13 +104,13 @@ protected class AggregatedKey { public readonly ImmutableArray DocumentIds; public readonly DiagnosticAnalyzer Analyzer; - public readonly DiagnosticIncrementalAnalyzer.StateType StateType; + public readonly int Kind; - public AggregatedKey(ImmutableArray documentIds, DiagnosticAnalyzer analyzer, DiagnosticIncrementalAnalyzer.StateType stateType) + public AggregatedKey(ImmutableArray documentIds, DiagnosticAnalyzer analyzer, int kind) { DocumentIds = documentIds; Analyzer = analyzer; - StateType = stateType; + Kind = kind; } public override bool Equals(object obj) @@ -121,12 +121,12 @@ public override bool Equals(object obj) return false; } - return this.DocumentIds == other.DocumentIds && this.Analyzer == other.Analyzer && this.StateType == other.StateType; + return this.DocumentIds == other.DocumentIds && this.Analyzer == other.Analyzer && this.Kind == other.Kind; } public override int GetHashCode() { - return Hash.Combine(Analyzer.GetHashCode(), Hash.Combine(DocumentIds.GetHashCode(), (int)StateType)); + return Hash.Combine(Analyzer.GetHashCode(), Hash.Combine(DocumentIds.GetHashCode(), Kind)); } } } -- GitLab