diff --git a/src/Microsoft.DotNet.Interactive.ApiCompatibility.Tests/ApiCompatibilityTests.Interactive_api_is_not_changed.approved.txt b/src/Microsoft.DotNet.Interactive.ApiCompatibility.Tests/ApiCompatibilityTests.Interactive_api_is_not_changed.approved.txt index 00671efcf2..db6a1273e4 100644 --- a/src/Microsoft.DotNet.Interactive.ApiCompatibility.Tests/ApiCompatibilityTests.Interactive_api_is_not_changed.approved.txt +++ b/src/Microsoft.DotNet.Interactive.ApiCompatibility.Tests/ApiCompatibilityTests.Interactive_api_is_not_changed.approved.txt @@ -441,13 +441,9 @@ Microsoft.DotNet.Interactive.Commands public Microsoft.DotNet.Interactive.FormattedValue FormattedValue { get;} public System.String Name { get;} public System.Object Value { get;} - public enum SubmissionType : System.Enum, System.IComparable, System.IConvertible, System.IFormattable - Run=0 - Diagnose=1 public class SubmitCode : KernelCommand, System.IEquatable - .ctor(System.String code, System.String targetKernelName = null, SubmissionType submissionType = Run) + .ctor(System.String code, System.String targetKernelName = null) public System.String Code { get;} - public SubmissionType SubmissionType { get;} public System.String ToString() public class UpdateDisplayedValue : KernelCommand, System.IEquatable .ctor(Microsoft.DotNet.Interactive.FormattedValue formattedValue, System.String valueId) diff --git a/src/Microsoft.DotNet.Interactive.CSharp/CSharpKernel.cs b/src/Microsoft.DotNet.Interactive.CSharp/CSharpKernel.cs index 0840392bde..9df3ed3ce1 100644 --- a/src/Microsoft.DotNet.Interactive.CSharp/CSharpKernel.cs +++ b/src/Microsoft.DotNet.Interactive.CSharp/CSharpKernel.cs @@ -290,11 +290,6 @@ async Task IKernelCommandHandler.HandleAsync(SubmitCode submitCode, context.Publish(new IncompleteCodeSubmissionReceived(submitCode)); } - if (submitCode.SubmissionType == SubmissionType.Diagnose) - { - return; - } - Exception exception = null; string message = null; diff --git a/src/Microsoft.DotNet.Interactive.Jupyter.Tests/Microsoft.DotNet.Interactive.Jupyter.Tests.v3.ncrunchproject b/src/Microsoft.DotNet.Interactive.Jupyter.Tests/Microsoft.DotNet.Interactive.Jupyter.Tests.v3.ncrunchproject index ac572a2bd8..758ba3de0a 100644 --- a/src/Microsoft.DotNet.Interactive.Jupyter.Tests/Microsoft.DotNet.Interactive.Jupyter.Tests.v3.ncrunchproject +++ b/src/Microsoft.DotNet.Interactive.Jupyter.Tests/Microsoft.DotNet.Interactive.Jupyter.Tests.v3.ncrunchproject @@ -21,9 +21,6 @@ Microsoft.DotNet.Interactive.Jupyter.Tests.InterruptRequestHandlerTests - - Microsoft.DotNet.Interactive.Jupyter.Tests.IsCompleteRequestHandlerTests - Microsoft.DotNet.Interactive.Jupyter.Tests.JupyterKernelTests diff --git a/src/Microsoft.DotNet.Interactive.Jupyter/IsCompleteRequestHandler.cs b/src/Microsoft.DotNet.Interactive.Jupyter/IsCompleteRequestHandler.cs index 852031143f..be93e06463 100644 --- a/src/Microsoft.DotNet.Interactive.Jupyter/IsCompleteRequestHandler.cs +++ b/src/Microsoft.DotNet.Interactive.Jupyter/IsCompleteRequestHandler.cs @@ -1,8 +1,10 @@ // Copyright (c) .NET Foundation and contributors. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. +using System.Linq; using System.Reactive.Concurrency; using System.Threading.Tasks; +using Microsoft.CodeAnalysis; using Microsoft.DotNet.Interactive.Commands; using Microsoft.DotNet.Interactive.Events; using Microsoft.DotNet.Interactive.Jupyter.Protocol; @@ -21,7 +23,7 @@ public async Task Handle(JupyterRequestContext context) { var isCompleteRequest = GetJupyterRequest(context); var targetKernelName = context.GetKernelName(); - var command = new SubmitCode(isCompleteRequest.Code, targetKernelName, submissionType: SubmissionType.Diagnose); + var command = new RequestDiagnostics(isCompleteRequest.Code, targetKernelName); await SendAsync(context, command); } @@ -32,11 +34,15 @@ protected override void OnKernelEventReceived( { switch (@event) { - case CompleteCodeSubmissionReceived _: - Reply(true, context.JupyterRequestMessageEnvelope, context.JupyterMessageSender); + case DiagnosticsProduced diagnosticsProduced: + if (diagnosticsProduced.Diagnostics.Any(d => d.Severity == DiagnosticSeverity.Error)) + { + Reply(false, context.JupyterRequestMessageEnvelope, context.JupyterMessageSender); + } break; - case IncompleteCodeSubmissionReceived _: - Reply(false, context.JupyterRequestMessageEnvelope, context.JupyterMessageSender); + + case CommandSucceeded _: + Reply(true, context.JupyterRequestMessageEnvelope, context.JupyterMessageSender); break; } } diff --git a/src/Microsoft.DotNet.Interactive.PowerShell/PowerShellKernel.cs b/src/Microsoft.DotNet.Interactive.PowerShell/PowerShellKernel.cs index 74c12f9daa..94e29c19c9 100644 --- a/src/Microsoft.DotNet.Interactive.PowerShell/PowerShellKernel.cs +++ b/src/Microsoft.DotNet.Interactive.PowerShell/PowerShellKernel.cs @@ -265,12 +265,6 @@ async Task IKernelCommandHandler.HandleAsync( return; } - // Do nothing if we get a Diagnose type. - if (submitCode.SubmissionType == SubmissionType.Diagnose) - { - return; - } - if (context.CancellationToken.IsCancellationRequested) { context.Fail(submitCode, null, "Command cancelled"); diff --git a/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Command_contract_has_not_been_broken.approved.SubmitCode.json b/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Command_contract_has_not_been_broken.approved.SubmitCode.json index 4fc2a65748..980a92f806 100644 --- a/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Command_contract_has_not_been_broken.approved.SubmitCode.json +++ b/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Command_contract_has_not_been_broken.approved.SubmitCode.json @@ -4,7 +4,6 @@ "commandType": "SubmitCode", "command": { "code": "123", - "submissionType": "run", "targetKernelName": "csharp", "originUri": null, "destinationUri": null diff --git a/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.CodeSubmissionReceived.json b/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.CodeSubmissionReceived.json index 6d01d7dd4e..275c6b4157 100644 --- a/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.CodeSubmissionReceived.json +++ b/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.CodeSubmissionReceived.json @@ -9,7 +9,6 @@ "commandType": "SubmitCode", "command": { "code": "123", - "submissionType": "run", "targetKernelName": null, "originUri": null, "destinationUri": null diff --git a/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.CommandFailed.json b/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.CommandFailed.json index d6395a4334..66a9453d7e 100644 --- a/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.CommandFailed.json +++ b/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.CommandFailed.json @@ -10,7 +10,6 @@ "commandType": "SubmitCode", "command": { "code": "123", - "submissionType": "run", "targetKernelName": null, "originUri": null, "destinationUri": null diff --git a/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.CommandSucceeded.json b/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.CommandSucceeded.json index 1afa5b1d17..10707653e0 100644 --- a/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.CommandSucceeded.json +++ b/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.CommandSucceeded.json @@ -9,7 +9,6 @@ "commandType": "SubmitCode", "command": { "code": "123", - "submissionType": "run", "targetKernelName": null, "originUri": null, "destinationUri": null diff --git a/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.CompleteCodeSubmissionReceived.json b/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.CompleteCodeSubmissionReceived.json index b2e0ea83e0..aeac699d27 100644 --- a/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.CompleteCodeSubmissionReceived.json +++ b/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.CompleteCodeSubmissionReceived.json @@ -9,7 +9,6 @@ "commandType": "SubmitCode", "command": { "code": "123", - "submissionType": "run", "targetKernelName": null, "originUri": null, "destinationUri": null diff --git a/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.DiagnosticsProduced.json b/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.DiagnosticsProduced.json index 352fda091a..00ab6ca44e 100644 --- a/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.DiagnosticsProduced.json +++ b/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.DiagnosticsProduced.json @@ -26,7 +26,6 @@ "commandType": "SubmitCode", "command": { "code": "123", - "submissionType": "run", "targetKernelName": null, "originUri": null, "destinationUri": null diff --git a/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.DisplayedValueProduced.json b/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.DisplayedValueProduced.json index 7ee0621886..6a744a56a4 100644 --- a/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.DisplayedValueProduced.json +++ b/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.DisplayedValueProduced.json @@ -16,7 +16,6 @@ "commandType": "SubmitCode", "command": { "code": "b(\"hi!\")", - "submissionType": "run", "targetKernelName": "csharp", "originUri": null, "destinationUri": null diff --git a/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.DisplayedValueUpdated.json b/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.DisplayedValueUpdated.json index c33d36c8ce..51292cbce3 100644 --- a/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.DisplayedValueUpdated.json +++ b/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.DisplayedValueUpdated.json @@ -16,7 +16,6 @@ "commandType": "SubmitCode", "command": { "code": "b(\"hi!\")", - "submissionType": "run", "targetKernelName": "csharp", "originUri": null, "destinationUri": null diff --git a/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.ErrorProduced.json b/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.ErrorProduced.json index 95e3e97953..bad1977fba 100644 --- a/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.ErrorProduced.json +++ b/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.ErrorProduced.json @@ -11,7 +11,6 @@ "commandType": "SubmitCode", "command": { "code": "123", - "submissionType": "run", "targetKernelName": null, "originUri": null, "destinationUri": null diff --git a/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.IncompleteCodeSubmissionReceived.json b/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.IncompleteCodeSubmissionReceived.json index 11f71d57c4..f768639ec7 100644 --- a/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.IncompleteCodeSubmissionReceived.json +++ b/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.IncompleteCodeSubmissionReceived.json @@ -7,7 +7,6 @@ "commandType": "SubmitCode", "command": { "code": "123", - "submissionType": "run", "targetKernelName": null, "originUri": null, "destinationUri": null diff --git a/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.KernelExtensionLoaded.json b/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.KernelExtensionLoaded.json index 869d9b5b9b..0df0e8154a 100644 --- a/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.KernelExtensionLoaded.json +++ b/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.KernelExtensionLoaded.json @@ -7,7 +7,6 @@ "commandType": "SubmitCode", "command": { "code": "#r \"nuget:package\" ", - "submissionType": "run", "targetKernelName": null, "originUri": null, "destinationUri": null diff --git a/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.PackageAdded.json b/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.PackageAdded.json index 81efc2f02b..ee0bd188f4 100644 --- a/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.PackageAdded.json +++ b/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.PackageAdded.json @@ -21,7 +21,6 @@ "commandType": "SubmitCode", "command": { "code": "#r \"nuget:ThePackage,1.2.3\"", - "submissionType": "run", "targetKernelName": null, "originUri": null, "destinationUri": null diff --git a/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.ReturnValueProduced.json b/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.ReturnValueProduced.json index e1d9140ae6..7e34bd6a1d 100644 --- a/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.ReturnValueProduced.json +++ b/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.ReturnValueProduced.json @@ -16,7 +16,6 @@ "commandType": "SubmitCode", "command": { "code": "b(\"hi!\")", - "submissionType": "run", "targetKernelName": "csharp", "originUri": null, "destinationUri": null diff --git a/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.StandardErrorValueProduced.json b/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.StandardErrorValueProduced.json index 762d7721f7..14459174fa 100644 --- a/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.StandardErrorValueProduced.json +++ b/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.StandardErrorValueProduced.json @@ -16,7 +16,6 @@ "commandType": "SubmitCode", "command": { "code": "123", - "submissionType": "run", "targetKernelName": null, "originUri": null, "destinationUri": null diff --git a/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.StandardOutputValueProduced.json b/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.StandardOutputValueProduced.json index dade6e3a12..c789cfb7c0 100644 --- a/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.StandardOutputValueProduced.json +++ b/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Event_contract_has_not_been_broken.approved.StandardOutputValueProduced.json @@ -16,7 +16,6 @@ "commandType": "SubmitCode", "command": { "code": "Console.Write(123);", - "submissionType": "run", "targetKernelName": "csharp", "originUri": null, "destinationUri": null diff --git a/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.cs b/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.cs index 039c10c7b1..111fedcaf5 100644 --- a/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.cs +++ b/src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.cs @@ -185,7 +185,7 @@ IEnumerable commands() yield return new SendEditableCode("someKernelName", "code"); - yield return new SubmitCode("123", "csharp", SubmissionType.Run); + yield return new SubmitCode("123", "csharp"); yield return new UpdateDisplayedValue( new FormattedValue("text/html", "hi!"), @@ -283,7 +283,7 @@ IEnumerable events() yield return new DisplayedValueProduced( new HtmlString("hi!"), - new SubmitCode("b(\"hi!\")", "csharp", SubmissionType.Run), + new SubmitCode("b(\"hi!\")", "csharp"), new[] { new FormattedValue("text/html", "hi!"), @@ -292,7 +292,7 @@ IEnumerable events() yield return new DisplayedValueUpdated( new HtmlString("hi!"), "the-value-id", - new SubmitCode("b(\"hi!\")", "csharp", SubmissionType.Run), + new SubmitCode("b(\"hi!\")", "csharp"), new[] { new FormattedValue("text/html", "hi!"), @@ -361,7 +361,7 @@ IEnumerable events() yield return new ReturnValueProduced( new HtmlString("hi!"), - new SubmitCode("b(\"hi!\")", "csharp", SubmissionType.Run), + new SubmitCode("b(\"hi!\")", "csharp"), new[] { new FormattedValue("text/html", "hi!"), @@ -390,7 +390,7 @@ IEnumerable events() }); yield return new StandardOutputValueProduced( - new SubmitCode("Console.Write(123);", "csharp", SubmissionType.Run), + new SubmitCode("Console.Write(123);", "csharp"), new[] { new FormattedValue("text/plain", "123") diff --git a/src/Microsoft.DotNet.Interactive.Tests/LanguageKernelTestBase.cs b/src/Microsoft.DotNet.Interactive.Tests/LanguageKernelTestBase.cs index 3d755036ec..f357b93056 100644 --- a/src/Microsoft.DotNet.Interactive.Tests/LanguageKernelTestBase.cs +++ b/src/Microsoft.DotNet.Interactive.Tests/LanguageKernelTestBase.cs @@ -162,18 +162,18 @@ protected virtual CSharpKernel CreateCSharpKernel() }); } - public async Task SubmitCode(Kernel kernel, string[] submissions, SubmissionType submissionType = SubmissionType.Run) + public async Task SubmitCode(Kernel kernel, string[] submissions) { foreach (var submission in submissions) { - var cmd = new SubmitCode(submission, submissionType: submissionType); + var cmd = new SubmitCode(submission); await kernel.SendAsync(cmd); } } - public async Task SubmitCode(Kernel kernel, string submission, SubmissionType submissionType = SubmissionType.Run) + public async Task SubmitCode(Kernel kernel, string submission) { - var command = new SubmitCode(submission, submissionType: submissionType); + var command = new SubmitCode(submission); return await kernel.SendAsync(command); } diff --git a/src/Microsoft.DotNet.Interactive.Tests/LanguageKernelTests.cs b/src/Microsoft.DotNet.Interactive.Tests/LanguageKernelTests.cs index f8f330076b..fe13df204f 100644 --- a/src/Microsoft.DotNet.Interactive.Tests/LanguageKernelTests.cs +++ b/src/Microsoft.DotNet.Interactive.Tests/LanguageKernelTests.cs @@ -713,7 +713,7 @@ public async Task requested_diagnostics_does_not_execute_directives_handlers(Lan [InlineData(Language.CSharp)] [InlineData(Language.PowerShell)] // no F# equivalent, because it doesn't have the concept of complete/incomplete submissions - public async Task it_can_analyze_incomplete_submissions(Language language) + public async Task it_acknowledges_receipt_of_incomplete_submissions(Language language) { var kernel = CreateKernel(language); @@ -723,7 +723,7 @@ public async Task it_can_analyze_incomplete_submissions(Language language) Language.PowerShell => "$a =" }; - await SubmitCode(kernel, source, submissionType: SubmissionType.Diagnose); + await SubmitCode(kernel, source); KernelEvents .Single(e => e is IncompleteCodeSubmissionReceived); @@ -737,7 +737,7 @@ public async Task it_can_analyze_incomplete_submissions(Language language) [InlineData(Language.CSharp)] [InlineData(Language.PowerShell)] // no F# equivalent, because it doesn't have the concept of complete/incomplete submissions - public async Task it_can_analyze_complete_submissions(Language language) + public async Task it_acknowledged_receipt_of_complete_submissions_having_return_value(Language language) { var kernel = CreateKernel(language); @@ -747,12 +747,8 @@ public async Task it_can_analyze_complete_submissions(Language language) Language.PowerShell => "25", }; - await SubmitCode(kernel, source, submissionType: SubmissionType.Diagnose); - - KernelEvents - .Should() - .NotContain(e => e is ReturnValueProduced); - + await SubmitCode(kernel, source); + KernelEvents .Should() .Contain(e => e is CompleteCodeSubmissionReceived); @@ -761,20 +757,16 @@ public async Task it_can_analyze_complete_submissions(Language language) [Theory] [InlineData(Language.CSharp)] // no F# equivalent, because it doesn't have the concept of complete/incomplete submissions - public async Task it_can_analyze_complete_stdio_submissions(Language language) + public async Task it_acknowledged_receipt_of_complete_stdio_submissions(Language language) { var kernel = CreateKernel(language); var source = language switch { - Language.CSharp => "Console.WriteLine(\"Hello\")" + Language.CSharp => "Console.WriteLine(\"Hello\");" }; - await SubmitCode(kernel, source, submissionType: SubmissionType.Diagnose); - - KernelEvents - .Should() - .NotContain(e => e is StandardOutputValueProduced); + await SubmitCode(kernel, source); KernelEvents .Should() @@ -819,7 +811,7 @@ public async Task it_does_not_return_a_result_for_a_statement(Language language) Language.CSharp => "if (true) { }" }; - await SubmitCode(kernel, source, submissionType: SubmissionType.Run); + await SubmitCode(kernel, source); KernelEvents .Should() diff --git a/src/Microsoft.DotNet.Interactive/Commands/SubmissionType.cs b/src/Microsoft.DotNet.Interactive/Commands/SubmissionType.cs deleted file mode 100644 index 1105b27f9d..0000000000 --- a/src/Microsoft.DotNet.Interactive/Commands/SubmissionType.cs +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) .NET Foundation and contributors. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. - - -namespace Microsoft.DotNet.Interactive.Commands; - -public enum SubmissionType -{ - Run = 0, - Diagnose -} \ No newline at end of file diff --git a/src/Microsoft.DotNet.Interactive/Commands/SubmitCode.cs b/src/Microsoft.DotNet.Interactive/Commands/SubmitCode.cs index c7c16f8cdc..7377713026 100644 --- a/src/Microsoft.DotNet.Interactive/Commands/SubmitCode.cs +++ b/src/Microsoft.DotNet.Interactive/Commands/SubmitCode.cs @@ -10,22 +10,18 @@ public class SubmitCode : KernelCommand { public SubmitCode( string code, - string targetKernelName = null, - SubmissionType submissionType = SubmissionType.Run) : base(targetKernelName) + string targetKernelName = null) : base(targetKernelName) { Code = code ?? throw new ArgumentNullException(nameof(code)); - SubmissionType = submissionType; } internal SubmitCode( LanguageNode languageNode, - SubmissionType submissionType = SubmissionType.Run, KernelNameDirectiveNode kernelNameDirectiveNode = null) : base(languageNode.Name) { Code = languageNode.Text; LanguageNode = languageNode; - SubmissionType = submissionType; KernelNameDirectiveNode = kernelNameDirectiveNode; SchedulingScope = languageNode.CommandScope; @@ -37,8 +33,6 @@ internal SubmitCode( public string Code { get; internal set; } - public SubmissionType SubmissionType { get; } - public override string ToString() => $"{nameof(SubmitCode)}: {Code?.TruncateForDisplay()}"; internal LanguageNode LanguageNode { get; } diff --git a/src/Microsoft.DotNet.Interactive/Parsing/SubmissionParser.cs b/src/Microsoft.DotNet.Interactive/Parsing/SubmissionParser.cs index 0f507e1165..5d7d397503 100644 --- a/src/Microsoft.DotNet.Interactive/Parsing/SubmissionParser.cs +++ b/src/Microsoft.DotNet.Interactive/Parsing/SubmissionParser.cs @@ -52,7 +52,7 @@ public IReadOnlyList SplitSubmission(SubmitCode submitCode) => { if (!string.IsNullOrWhiteSpace(languageNode.Text)) { - return new SubmitCode(languageNode, submitCode.SubmissionType, kernelNameNode); + return new SubmitCode(languageNode, kernelNameNode); } else { diff --git a/src/interface-generator/InterfaceGenerator.cs b/src/interface-generator/InterfaceGenerator.cs index 87f5a7048e..4e226a1307 100644 --- a/src/interface-generator/InterfaceGenerator.cs +++ b/src/interface-generator/InterfaceGenerator.cs @@ -69,7 +69,6 @@ public class InterfaceGenerator $"{nameof(DocumentOpened)}.{nameof(DocumentOpened.RegionName)}", $"{nameof(HoverTextProduced)}.{nameof(HoverTextProduced.LinePositionSpan)}", $"{nameof(OpenDocument)}.{nameof(OpenDocument.RegionName)}", - $"{nameof(SubmitCode)}.{nameof(SubmitCode.SubmissionType)}", $"{nameof(KernelCommand)}.{nameof(KernelCommand.TargetKernelName)}", $"{nameof(KernelCommand)}.{nameof(KernelCommand.DestinationUri)}", diff --git a/src/polyglot-notebooks-vscode-common/src/interactiveClient.ts b/src/polyglot-notebooks-vscode-common/src/interactiveClient.ts index 3260f39881..7cbace09be 100644 --- a/src/polyglot-notebooks-vscode-common/src/interactiveClient.ts +++ b/src/polyglot-notebooks-vscode-common/src/interactiveClient.ts @@ -46,7 +46,6 @@ import { ValueInfosProducedType, ValueProduced, ValueProducedType, - SubmissionType, SubmitCode, SubmitCodeType, CancelType, @@ -155,7 +154,6 @@ export class InteractiveClient { SubmitCodeType, { code: source, - submissionType: SubmissionType.Run, targetKernelName: language } ); diff --git a/src/polyglot-notebooks/src/contracts.ts b/src/polyglot-notebooks/src/contracts.ts index 6d1e752d2d..b83a111a5f 100644 --- a/src/polyglot-notebooks/src/contracts.ts +++ b/src/polyglot-notebooks/src/contracts.ts @@ -134,7 +134,6 @@ export interface SendValue extends KernelCommand { export interface SubmitCode extends KernelCommand { code: string; - submissionType?: SubmissionType; } export interface UpdateDisplayedValue extends KernelCommand { @@ -518,8 +517,3 @@ export interface ParameterInformation { documentation: FormattedValue; } -export enum SubmissionType { - Run = "run", - Diagnose = "diagnose", -} -