diff --git a/src/Features/CSharpTest/Copilot/CSharpImplementNotImplementedExceptionFixProviderTests.cs b/src/Features/CSharpTest/Copilot/CSharpImplementNotImplementedExceptionFixProviderTests.cs index 1bd47a290ce1f..242228c5e8c45 100644 --- a/src/Features/CSharpTest/Copilot/CSharpImplementNotImplementedExceptionFixProviderTests.cs +++ b/src/Features/CSharpTest/Copilot/CSharpImplementNotImplementedExceptionFixProviderTests.cs @@ -410,71 +410,6 @@ public interface IDataService .RunAsync(); } - [Fact] - public async Task HandleInvalidCode_SuggestsAsComment() - { - await new CustomCompositionCSharpTest - { - CodeFixTestBehaviors = CodeFixTestBehaviors.FixOne, - TestCode = """ - using System; - - class C - { - void M() - { - {|IDE3000:throw new NotImplementedException();|} - } - } - """, - FixedCode = """ - using System; - - class C - { - /* The generated implementation isn't a valid method or property: - using System; - class C - { - void M() - { - throw new NotImplementedException(); - } - } */ - void M() - { - {|IDE3000:throw new NotImplementedException();|} - } - } - """, - FixedState = - { - MarkupHandling = MarkupMode.Allow, - }, - LanguageVersion = LanguageVersion.CSharp11, - ReferenceAssemblies = ReferenceAssemblies.Net.Net60, - } - .WithMockCopilotService(copilotService => - { - var replacement = """ - using System; - class C - { - void M() - { - throw new NotImplementedException(); - } - } - """; - copilotService.PrepareUsingSingleFakeResult = new() - { - ReplacementNode = SyntaxFactory.ParseCompilationUnit(replacement), - Message = $"The generated implementation isn't a valid method or property:{Environment.NewLine}{replacement}", - }; - }) - .RunAsync(); - } - [Fact] public async Task ReplacementNode_Null_NotifiesWithComment() { diff --git a/src/Features/Core/Portable/Copilot/ImplementationDetails.cs b/src/Features/Core/Portable/Copilot/ImplementationDetails.cs index 3d001e1e8cc71..1aefe4c870155 100644 --- a/src/Features/Core/Portable/Copilot/ImplementationDetails.cs +++ b/src/Features/Core/Portable/Copilot/ImplementationDetails.cs @@ -2,6 +2,8 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +using Microsoft.CodeAnalysis.CSharp.Syntax; + namespace Microsoft.CodeAnalysis.Copilot; /// @@ -16,7 +18,7 @@ internal sealed class ImplementationDetails public string? Message { get; init; } /// - /// Gets the replacement syntax node. Either this property or must be set. + /// Gets the replacement node. Either this property or must be set. /// - public SyntaxNode? ReplacementNode { get; init; } + public MemberDeclarationSyntax? ReplacementNode { get; init; } } diff --git a/src/Features/ExternalAccess/Copilot/GenerateImplementation/ImplementationDetailsWrapper.cs b/src/Features/ExternalAccess/Copilot/GenerateImplementation/ImplementationDetailsWrapper.cs index 9cfcb8bdf5c4b..43190dc393ed1 100644 --- a/src/Features/ExternalAccess/Copilot/GenerateImplementation/ImplementationDetailsWrapper.cs +++ b/src/Features/ExternalAccess/Copilot/GenerateImplementation/ImplementationDetailsWrapper.cs @@ -2,6 +2,8 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +using Microsoft.CodeAnalysis.CSharp.Syntax; + namespace Microsoft.CodeAnalysis.ExternalAccess.Copilot.GenerateImplementation; /// @@ -18,5 +20,5 @@ internal sealed class ImplementationDetailsWrapper /// /// Gets the replacement syntax node. Either this property or must be set. /// - public SyntaxNode? ReplacementNode { get; init; } + public MemberDeclarationSyntax? ReplacementNode { get; init; } } diff --git a/src/Features/ExternalAccess/Copilot/InternalAPI.Unshipped.txt b/src/Features/ExternalAccess/Copilot/InternalAPI.Unshipped.txt index 52c76edce89ff..485c3b9368dd8 100644 --- a/src/Features/ExternalAccess/Copilot/InternalAPI.Unshipped.txt +++ b/src/Features/ExternalAccess/Copilot/InternalAPI.Unshipped.txt @@ -35,7 +35,7 @@ Microsoft.CodeAnalysis.ExternalAccess.Copilot.GenerateImplementation.Implementat Microsoft.CodeAnalysis.ExternalAccess.Copilot.GenerateImplementation.ImplementationDetailsWrapper.ImplementationDetailsWrapper() -> void Microsoft.CodeAnalysis.ExternalAccess.Copilot.GenerateImplementation.ImplementationDetailsWrapper.Message.get -> string? Microsoft.CodeAnalysis.ExternalAccess.Copilot.GenerateImplementation.ImplementationDetailsWrapper.Message.init -> void -Microsoft.CodeAnalysis.ExternalAccess.Copilot.GenerateImplementation.ImplementationDetailsWrapper.ReplacementNode.get -> Microsoft.CodeAnalysis.SyntaxNode? +Microsoft.CodeAnalysis.ExternalAccess.Copilot.GenerateImplementation.ImplementationDetailsWrapper.ReplacementNode.get -> Microsoft.CodeAnalysis.CSharp.Syntax.MemberDeclarationSyntax? Microsoft.CodeAnalysis.ExternalAccess.Copilot.GenerateImplementation.ImplementationDetailsWrapper.ReplacementNode.init -> void Microsoft.CodeAnalysis.ExternalAccess.Copilot.IExternalCSharpCopilotCodeAnalysisService Microsoft.CodeAnalysis.ExternalAccess.Copilot.IExternalCSharpCopilotCodeAnalysisService.AnalyzeDocumentAsync(Microsoft.CodeAnalysis.Document! document, Microsoft.CodeAnalysis.Text.TextSpan? span, string! promptTitle, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task>!