diff --git a/src/EditorFeatures/Test2/CodeFixes/CodeFixServiceTests.vb b/src/EditorFeatures/Test2/CodeFixes/CodeFixServiceTests.vb index cab76f41eba63..5176fb2119f8f 100644 --- a/src/EditorFeatures/Test2/CodeFixes/CodeFixServiceTests.vb +++ b/src/EditorFeatures/Test2/CodeFixes/CodeFixServiceTests.vb @@ -25,7 +25,6 @@ Imports Microsoft.CodeAnalysis.UnitTests Imports Roslyn.Utilities Namespace Microsoft.CodeAnalysis.Editor.Implementation.CodeFixes.UnitTests - <[UseExportProvider]> Public Class CodeFixServiceTests @@ -380,8 +379,8 @@ Namespace Microsoft.CodeAnalysis.Editor.Implementation.CodeFixes.UnitTests Return Task.FromResult(False) End Function - Public Function ImplementNotImplementedExceptionsAsync(document As Document, methodOrProperties As ImmutableDictionary(Of CodeAnalysis.CSharp.Syntax.MemberDeclarationSyntax, ImmutableArray(Of ReferencedSymbol)), cancellationToken As CancellationToken) As Task(Of ImmutableDictionary(Of CodeAnalysis.CSharp.Syntax.MemberDeclarationSyntax, ImplementationDetails)) Implements ICopilotCodeAnalysisService.ImplementNotImplementedExceptionsAsync - Return Task.FromResult(ImmutableDictionary(Of CodeAnalysis.CSharp.Syntax.MemberDeclarationSyntax, ImplementationDetails).Empty) + Public Function ImplementNotImplementedExceptionsAsync(document As Document, methodOrProperties As ImmutableDictionary(Of SyntaxNode, ImmutableArray(Of ReferencedSymbol)), cancellationToken As CancellationToken) As Task(Of ImmutableDictionary(Of SyntaxNode, ImplementationDetails)) Implements ICopilotCodeAnalysisService.ImplementNotImplementedExceptionsAsync + Return Task.FromResult(ImmutableDictionary(Of SyntaxNode, ImplementationDetails).Empty) End Function End Class End Class diff --git a/src/Features/CSharp/Portable/Copilot/CSharpImplementNotImplementedExceptionFixProvider.cs b/src/Features/CSharp/Portable/Copilot/CSharpImplementNotImplementedExceptionFixProvider.cs index 8684e4c88d745..a39bdfde898bf 100644 --- a/src/Features/CSharp/Portable/Copilot/CSharpImplementNotImplementedExceptionFixProvider.cs +++ b/src/Features/CSharp/Portable/Copilot/CSharpImplementNotImplementedExceptionFixProvider.cs @@ -79,7 +79,7 @@ protected override async Task FixAllAsync( Document document, ImmutableArray diagnostics, SyntaxEditor editor, CancellationToken cancellationToken) { - var memberReferencesBuilder = ImmutableDictionary.CreateBuilder>(); + var memberReferencesBuilder = ImmutableDictionary.CreateBuilder>(); var semanticModel = await document.GetRequiredSemanticModelAsync(cancellationToken).ConfigureAwait(false); foreach (var diagnostic in diagnostics) @@ -102,8 +102,10 @@ protected override async Task FixAllAsync( var copilotService = document.GetRequiredLanguageService(); var memberImplementationDetails = await copilotService.ImplementNotImplementedExceptionsAsync(document, memberReferencesBuilder.ToImmutable(), cancellationToken).ConfigureAwait(false); - foreach (var methodOrProperty in memberReferencesBuilder.Keys) + foreach (var node in memberReferencesBuilder.Keys) { + var methodOrProperty = (MemberDeclarationSyntax)node; + Contract.ThrowIfFalse(memberImplementationDetails.TryGetValue(methodOrProperty, out var implementationDetails)); var replacement = implementationDetails.ReplacementNode; diff --git a/src/Features/CSharpTest/Copilot/CSharpImplementNotImplementedExceptionFixProviderTests.cs b/src/Features/CSharpTest/Copilot/CSharpImplementNotImplementedExceptionFixProviderTests.cs index 1bd47a290ce1f..fd66dcfecd896 100644 --- a/src/Features/CSharpTest/Copilot/CSharpImplementNotImplementedExceptionFixProviderTests.cs +++ b/src/Features/CSharpTest/Copilot/CSharpImplementNotImplementedExceptionFixProviderTests.cs @@ -173,7 +173,7 @@ public interface IMathService } .WithMockCopilotService(copilotService => { - copilotService.SetupFixAll = (Document document, ImmutableDictionary> memberReferences, CancellationToken cancellationToken) => + copilotService.SetupFixAll = (Document document, ImmutableDictionary> memberReferences, CancellationToken cancellationToken) => { // Create a map of method/property implementations var implementationMap = new Dictionary @@ -192,7 +192,7 @@ public interface IMathService }; // Process each member reference and create implementation details - var resultsBuilder = ImmutableDictionary.CreateBuilder(); + var resultsBuilder = ImmutableDictionary.CreateBuilder(); foreach (var memberReference in memberReferences) { var memberNode = memberReference.Key; @@ -634,7 +634,7 @@ public TestCopilotCodeAnalysisService() { } - public Func>, CancellationToken, ImmutableDictionary>? SetupFixAll { get; internal set; } + public Func>, CancellationToken, ImmutableDictionary>? SetupFixAll { get; internal set; } public ImplementationDetails? PrepareUsingSingleFakeResult { get; internal set; } @@ -662,9 +662,9 @@ public Task StartRefinementSessionAsync(Document oldDocument, Document newDocume Task<(Dictionary? responseDictionary, bool isQuotaExceeded)> ICopilotCodeAnalysisService.GetDocumentationCommentAsync(DocumentationCommentProposal proposal, CancellationToken cancellationToken) => throw new NotImplementedException(); - public Task> ImplementNotImplementedExceptionsAsync( + public Task> ImplementNotImplementedExceptionsAsync( Document document, - ImmutableDictionary> methodOrProperties, + ImmutableDictionary> methodOrProperties, CancellationToken cancellationToken) { if (SetupFixAll != null) @@ -677,14 +677,14 @@ public Task> return Task.FromResult(CreateSingleNodeResult(methodOrProperties, PrepareUsingSingleFakeResult)); } - return Task.FromResult(ImmutableDictionary.Empty); + return Task.FromResult(ImmutableDictionary.Empty); } - private static ImmutableDictionary CreateSingleNodeResult( - ImmutableDictionary> methodOrProperties, + private static ImmutableDictionary CreateSingleNodeResult( + ImmutableDictionary> methodOrProperties, ImplementationDetails implementationDetails) { - var resultsBuilder = ImmutableDictionary.CreateBuilder(); + var resultsBuilder = ImmutableDictionary.CreateBuilder(); foreach (var methodOrProperty in methodOrProperties) { resultsBuilder.Add(methodOrProperty.Key, implementationDetails); diff --git a/src/Features/Core/Portable/Copilot/ICopilotCodeAnalysisService.cs b/src/Features/Core/Portable/Copilot/ICopilotCodeAnalysisService.cs index 0df44b14c6463..c8e4a55485f86 100644 --- a/src/Features/Core/Portable/Copilot/ICopilotCodeAnalysisService.cs +++ b/src/Features/Core/Portable/Copilot/ICopilotCodeAnalysisService.cs @@ -6,7 +6,6 @@ using System.Collections.Immutable; using System.Threading; using System.Threading.Tasks; -using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.CodeAnalysis.DocumentationComments; using Microsoft.CodeAnalysis.FindSymbols; using Microsoft.CodeAnalysis.Host; @@ -98,8 +97,8 @@ internal interface ICopilotCodeAnalysisService : ILanguageService /// Implements methods or properties containing throws in the given . /// /// A dictionary mapping the original syntax nodes to their implementation details. - Task> ImplementNotImplementedExceptionsAsync( + Task> ImplementNotImplementedExceptionsAsync( Document document, - ImmutableDictionary> methodOrProperties, + ImmutableDictionary> methodOrProperties, CancellationToken cancellationToken); } diff --git a/src/Features/Core/Portable/Microsoft.CodeAnalysis.Features.csproj b/src/Features/Core/Portable/Microsoft.CodeAnalysis.Features.csproj index 26923dd9450e8..1424adb97aa32 100644 --- a/src/Features/Core/Portable/Microsoft.CodeAnalysis.Features.csproj +++ b/src/Features/Core/Portable/Microsoft.CodeAnalysis.Features.csproj @@ -16,7 +16,6 @@ - diff --git a/src/Features/ExternalAccess/Copilot/GenerateImplementation/IExternalCSharpCopilotGenerateImplementationService.cs b/src/Features/ExternalAccess/Copilot/GenerateImplementation/IExternalCSharpCopilotGenerateImplementationService.cs index ebc044871c47b..906712857e536 100644 --- a/src/Features/ExternalAccess/Copilot/GenerateImplementation/IExternalCSharpCopilotGenerateImplementationService.cs +++ b/src/Features/ExternalAccess/Copilot/GenerateImplementation/IExternalCSharpCopilotGenerateImplementationService.cs @@ -5,7 +5,6 @@ using System.Collections.Immutable; using System.Threading; using System.Threading.Tasks; -using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.CodeAnalysis.ExternalAccess.Copilot.GenerateImplementation; using Microsoft.CodeAnalysis.FindSymbols; @@ -13,8 +12,8 @@ namespace Microsoft.CodeAnalysis.ExternalAccess.Copilot; internal interface IExternalCSharpCopilotGenerateImplementationService { - Task> ImplementNotImplementedExceptionsAsync( + Task> ImplementNotImplementedExceptionsAsync( Document document, - ImmutableDictionary> methodOrProperties, + ImmutableDictionary> methodOrProperties, CancellationToken cancellationToken); } diff --git a/src/Features/ExternalAccess/Copilot/Internal/Analyzer/AbstractCopilotCodeAnalysisService.cs b/src/Features/ExternalAccess/Copilot/Internal/Analyzer/AbstractCopilotCodeAnalysisService.cs index e5ae13688b414..48af70a1e8696 100644 --- a/src/Features/ExternalAccess/Copilot/Internal/Analyzer/AbstractCopilotCodeAnalysisService.cs +++ b/src/Features/ExternalAccess/Copilot/Internal/Analyzer/AbstractCopilotCodeAnalysisService.cs @@ -9,7 +9,6 @@ using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis.Copilot; -using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.CodeAnalysis.Diagnostics; using Microsoft.CodeAnalysis.DocumentationComments; using Microsoft.CodeAnalysis.FindSymbols; @@ -46,7 +45,7 @@ internal abstract class AbstractCopilotCodeAnalysisService(IDiagnosticsRefresher protected abstract Task<(string responseString, bool isQuotaExceeded)> GetOnTheFlyDocsResponseCoreAsync(string prompt, CancellationToken cancellationToken); protected abstract Task IsFileExcludedCoreAsync(string filePath, CancellationToken cancellationToken); protected abstract Task<(Dictionary? responseDictionary, bool isQuotaExceeded)> GetDocumentationCommentCoreAsync(DocumentationCommentProposal proposal, CancellationToken cancellationToken); - protected abstract Task> ImplementNotImplementedExceptionsCoreAsync(Document document, ImmutableDictionary> methodOrProperties, CancellationToken cancellationToken); + protected abstract Task> ImplementNotImplementedExceptionsCoreAsync(Document document, ImmutableDictionary> methodOrProperties, CancellationToken cancellationToken); protected abstract bool IsImplementNotImplementedExceptionsAvailableCore(); public Task IsAvailableAsync(CancellationToken cancellationToken) @@ -214,9 +213,9 @@ public async Task IsImplementNotImplementedExceptionsAvailableAsync(Cancel && IsImplementNotImplementedExceptionsAvailableCore(); } - public async Task> ImplementNotImplementedExceptionsAsync( + public async Task> ImplementNotImplementedExceptionsAsync( Document document, - ImmutableDictionary> methodOrProperties, + ImmutableDictionary> methodOrProperties, CancellationToken cancellationToken) { return await ImplementNotImplementedExceptionsCoreAsync(document, methodOrProperties, cancellationToken).ConfigureAwait(false); diff --git a/src/Features/ExternalAccess/Copilot/Internal/Analyzer/CSharp/CSharpCopilotCodeAnalysisService.cs b/src/Features/ExternalAccess/Copilot/Internal/Analyzer/CSharp/CSharpCopilotCodeAnalysisService.cs index 3aacb5260141a..ac005eb0be0e0 100644 --- a/src/Features/ExternalAccess/Copilot/Internal/Analyzer/CSharp/CSharpCopilotCodeAnalysisService.cs +++ b/src/Features/ExternalAccess/Copilot/Internal/Analyzer/CSharp/CSharpCopilotCodeAnalysisService.cs @@ -9,7 +9,6 @@ using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis.Copilot; -using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.CodeAnalysis.Diagnostics; using Microsoft.CodeAnalysis.DocumentationComments; using Microsoft.CodeAnalysis.ErrorReporting; @@ -157,15 +156,15 @@ protected override bool IsImplementNotImplementedExceptionsAvailableCore() return GenerateImplementationService is not null; } - protected override async Task> ImplementNotImplementedExceptionsCoreAsync( + protected override async Task> ImplementNotImplementedExceptionsCoreAsync( Document document, - ImmutableDictionary> methodOrProperties, + ImmutableDictionary> methodOrProperties, CancellationToken cancellationToken) { Contract.ThrowIfNull(GenerateImplementationService); var nodeToWrappers = await GenerateImplementationService.ImplementNotImplementedExceptionsAsync(document, methodOrProperties, cancellationToken).ConfigureAwait(false); - var resultBuilder = ImmutableDictionary.CreateBuilder(); + var resultBuilder = ImmutableDictionary.CreateBuilder(); foreach (var nodeToWrapper in nodeToWrappers) { resultBuilder.Add( diff --git a/src/Features/ExternalAccess/Copilot/InternalAPI.Unshipped.txt b/src/Features/ExternalAccess/Copilot/InternalAPI.Unshipped.txt index 52c76edce89ff..7cbb6fdf54e5a 100644 --- a/src/Features/ExternalAccess/Copilot/InternalAPI.Unshipped.txt +++ b/src/Features/ExternalAccess/Copilot/InternalAPI.Unshipped.txt @@ -47,11 +47,11 @@ Microsoft.CodeAnalysis.ExternalAccess.Copilot.IExternalCSharpCopilotCodeAnalysis Microsoft.CodeAnalysis.ExternalAccess.Copilot.IExternalCSharpCopilotCodeAnalysisService.StartRefinementSessionAsync(Microsoft.CodeAnalysis.Document! oldDocument, Microsoft.CodeAnalysis.Document! newDocument, Microsoft.CodeAnalysis.Diagnostic? primaryDiagnostic, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task! Microsoft.CodeAnalysis.ExternalAccess.Copilot.IExternalCSharpCopilotGenerateDocumentationService Microsoft.CodeAnalysis.ExternalAccess.Copilot.IExternalCSharpCopilotGenerateDocumentationService.GetDocumentationCommentAsync(Microsoft.CodeAnalysis.ExternalAccess.Copilot.CopilotDocumentationCommentProposalWrapper! proposal, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task<(System.Collections.Generic.Dictionary? responseDictionary, bool isQuotaExceeded)>! +Microsoft.CodeAnalysis.ExternalAccess.Copilot.IExternalCSharpCopilotGenerateImplementationService.ImplementNotImplementedExceptionsAsync(Microsoft.CodeAnalysis.Document! document, System.Collections.Immutable.ImmutableDictionary>! methodOrProperties, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task!>! Microsoft.CodeAnalysis.ExternalAccess.Copilot.IExternalCSharpOnTheFlyDocsService Microsoft.CodeAnalysis.ExternalAccess.Copilot.IExternalCSharpOnTheFlyDocsService.GetOnTheFlyDocsPromptAsync(Microsoft.CodeAnalysis.ExternalAccess.Copilot.CopilotOnTheFlyDocsInfoWrapper! onTheFlyDocsInfo, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task! Microsoft.CodeAnalysis.ExternalAccess.Copilot.IExternalCSharpOnTheFlyDocsService.GetOnTheFlyDocsResponseAsync(string! prompt, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task<(string! responseString, bool isQuotaExceeded)>! Microsoft.CodeAnalysis.ExternalAccess.Copilot.IExternalCSharpCopilotGenerateImplementationService -Microsoft.CodeAnalysis.ExternalAccess.Copilot.IExternalCSharpCopilotGenerateImplementationService.ImplementNotImplementedExceptionsAsync(Microsoft.CodeAnalysis.Document! document, System.Collections.Immutable.ImmutableDictionary>! methodOrProperties, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task!>! Microsoft.CodeAnalysis.ExternalAccess.Copilot.RelatedDocuments.ICopilotRelatedDocumentsService Microsoft.CodeAnalysis.ExternalAccess.Copilot.RelatedDocuments.ICopilotRelatedDocumentsService.GetRelatedDocumentIdsAsync(Microsoft.CodeAnalysis.Document! document, int position, System.Func, System.Threading.CancellationToken, System.Threading.Tasks.ValueTask>! callbackAsync, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.ValueTask Microsoft.CodeAnalysis.ExternalAccess.Copilot.SemanticSearch.ISemanticSearchCopilotServiceImpl diff --git a/src/Features/ExternalAccess/Copilot/Microsoft.CodeAnalysis.ExternalAccess.Copilot.csproj b/src/Features/ExternalAccess/Copilot/Microsoft.CodeAnalysis.ExternalAccess.Copilot.csproj index f8e0118535f6a..69e66be254d12 100644 --- a/src/Features/ExternalAccess/Copilot/Microsoft.CodeAnalysis.ExternalAccess.Copilot.csproj +++ b/src/Features/ExternalAccess/Copilot/Microsoft.CodeAnalysis.ExternalAccess.Copilot.csproj @@ -26,7 +26,6 @@ - diff --git a/src/Tools/SemanticSearch/ReferenceAssemblies/Apis/Microsoft.CodeAnalysis.CSharp.txt b/src/Tools/SemanticSearch/ReferenceAssemblies/Apis/Microsoft.CodeAnalysis.CSharp.txt index 2bdd939afa897..dfbf205adf0a5 100644 --- a/src/Tools/SemanticSearch/ReferenceAssemblies/Apis/Microsoft.CodeAnalysis.CSharp.txt +++ b/src/Tools/SemanticSearch/ReferenceAssemblies/Apis/Microsoft.CodeAnalysis.CSharp.txt @@ -1,4 +1,4 @@ -# Generated, do not update manually +# Generated, do not update manually Microsoft.CodeAnalysis.CSharp.AwaitExpressionInfo Microsoft.CodeAnalysis.CSharp.AwaitExpressionInfo.Equals(Microsoft.CodeAnalysis.CSharp.AwaitExpressionInfo) Microsoft.CodeAnalysis.CSharp.AwaitExpressionInfo.Equals(System.Object) diff --git a/src/Tools/SemanticSearch/ReferenceAssemblies/Apis/Microsoft.CodeAnalysis.txt b/src/Tools/SemanticSearch/ReferenceAssemblies/Apis/Microsoft.CodeAnalysis.txt index a90379c35f8fe..5db3ecf67e2a4 100644 --- a/src/Tools/SemanticSearch/ReferenceAssemblies/Apis/Microsoft.CodeAnalysis.txt +++ b/src/Tools/SemanticSearch/ReferenceAssemblies/Apis/Microsoft.CodeAnalysis.txt @@ -1,4 +1,4 @@ -# Generated, do not update manually +# Generated, do not update manually Microsoft.CodeAnalysis.Accessibility Microsoft.CodeAnalysis.Accessibility.Friend Microsoft.CodeAnalysis.Accessibility.Internal diff --git a/src/Tools/SemanticSearch/ReferenceAssemblies/Apis/System.Collections.Immutable.txt b/src/Tools/SemanticSearch/ReferenceAssemblies/Apis/System.Collections.Immutable.txt index 1977066cdea78..ffdecae177f85 100644 --- a/src/Tools/SemanticSearch/ReferenceAssemblies/Apis/System.Collections.Immutable.txt +++ b/src/Tools/SemanticSearch/ReferenceAssemblies/Apis/System.Collections.Immutable.txt @@ -1,4 +1,4 @@ -# Generated, do not update manually +# Generated, do not update manually System.Collections.Frozen.FrozenDictionary System.Collections.Frozen.FrozenDictionary.ToFrozenDictionary``2(System.Collections.Generic.IEnumerable{System.Collections.Generic.KeyValuePair{``0,``1}},System.Collections.Generic.IEqualityComparer{``0}) System.Collections.Frozen.FrozenDictionary.ToFrozenDictionary``2(System.Collections.Generic.IEnumerable{``0},System.Func{``0,``1},System.Collections.Generic.IEqualityComparer{``1}) diff --git a/src/Tools/SemanticSearch/ReferenceAssemblies/Apis/System.Collections.txt b/src/Tools/SemanticSearch/ReferenceAssemblies/Apis/System.Collections.txt index 62f756acc8c59..4071eee51a37e 100644 --- a/src/Tools/SemanticSearch/ReferenceAssemblies/Apis/System.Collections.txt +++ b/src/Tools/SemanticSearch/ReferenceAssemblies/Apis/System.Collections.txt @@ -1,4 +1,4 @@ -# Generated, do not update manually +# Generated, do not update manually System.Collections.BitArray System.Collections.BitArray.#ctor(System.Boolean[]) System.Collections.BitArray.#ctor(System.Byte[]) diff --git a/src/Tools/SemanticSearch/ReferenceAssemblies/Apis/System.Linq.txt b/src/Tools/SemanticSearch/ReferenceAssemblies/Apis/System.Linq.txt index 85c524ab52cba..6bc2f9932b265 100644 --- a/src/Tools/SemanticSearch/ReferenceAssemblies/Apis/System.Linq.txt +++ b/src/Tools/SemanticSearch/ReferenceAssemblies/Apis/System.Linq.txt @@ -1,4 +1,4 @@ -# Generated, do not update manually +# Generated, do not update manually System.Linq.Enumerable System.Linq.Enumerable.Aggregate``1(System.Collections.Generic.IEnumerable{``0},System.Func{``0,``0,``0}) System.Linq.Enumerable.Aggregate``2(System.Collections.Generic.IEnumerable{``0},``1,System.Func{``1,``0,``1}) diff --git a/src/Tools/SemanticSearch/ReferenceAssemblies/Apis/System.Runtime.txt b/src/Tools/SemanticSearch/ReferenceAssemblies/Apis/System.Runtime.txt index cb02fc218dc5f..e43bf8dc555ae 100644 --- a/src/Tools/SemanticSearch/ReferenceAssemblies/Apis/System.Runtime.txt +++ b/src/Tools/SemanticSearch/ReferenceAssemblies/Apis/System.Runtime.txt @@ -1,4 +1,4 @@ -# Generated, do not update manually +# Generated, do not update manually System.AccessViolationException System.AccessViolationException.#ctor System.AccessViolationException.#ctor(System.Runtime.Serialization.SerializationInfo,System.Runtime.Serialization.StreamingContext)