Skip to content
This repository was archived by the owner on Apr 27, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -380,10 +380,6 @@ Microsoft.DotNet.Interactive.Commands
public class Cancel : KernelCommand, System.IEquatable<KernelCommand>
.ctor(System.String targetKernelName = null)
public System.Threading.Tasks.Task InvokeAsync(Microsoft.DotNet.Interactive.KernelInvocationContext context)
public class ChangeWorkingDirectory : KernelCommand, System.IEquatable<KernelCommand>
.ctor(System.String workingDirectory)
public System.String WorkingDirectory { get;}
public System.Threading.Tasks.Task InvokeAsync(Microsoft.DotNet.Interactive.KernelInvocationContext context)
public class DisplayError : KernelCommand, System.IEquatable<KernelCommand>
.ctor(System.String message)
public System.String Message { get;}
Expand Down Expand Up @@ -661,9 +657,6 @@ Microsoft.DotNet.Interactive.Events
public Microsoft.DotNet.Interactive.FormattedValue FormattedValue { get;}
public System.String Name { get;}
public System.Object Value { get;}
public class WorkingDirectoryChanged : KernelEvent
.ctor(System.String workingDirectory, Microsoft.DotNet.Interactive.Commands.KernelCommand command)
public System.String WorkingDirectory { get;}
Microsoft.DotNet.Interactive.Http
public static class JavascriptUtilities
public static System.String GetCodeForEnsureRequireJs(System.Uri requireJsUri = null, System.String onRequirejsLoadedCallBackName = null)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Microsoft.DotNet.Interactive.CSharp
public class CSharpKernel : Microsoft.DotNet.Interactive.Kernel, Microsoft.DotNet.Interactive.IKernelCommandHandler<Microsoft.DotNet.Interactive.Commands.ChangeWorkingDirectory>, Microsoft.DotNet.Interactive.IKernelCommandHandler<Microsoft.DotNet.Interactive.Commands.RequestCompletions>, Microsoft.DotNet.Interactive.IKernelCommandHandler<Microsoft.DotNet.Interactive.Commands.RequestDiagnostics>, Microsoft.DotNet.Interactive.IKernelCommandHandler<Microsoft.DotNet.Interactive.Commands.RequestHoverText>, Microsoft.DotNet.Interactive.IKernelCommandHandler<Microsoft.DotNet.Interactive.Commands.RequestKernelInfo>, Microsoft.DotNet.Interactive.IKernelCommandHandler<Microsoft.DotNet.Interactive.Commands.RequestSignatureHelp>, Microsoft.DotNet.Interactive.IKernelCommandHandler<Microsoft.DotNet.Interactive.Commands.RequestValue>, Microsoft.DotNet.Interactive.IKernelCommandHandler<Microsoft.DotNet.Interactive.Commands.RequestValueInfos>, Microsoft.DotNet.Interactive.IKernelCommandHandler<Microsoft.DotNet.Interactive.Commands.SendValue>, Microsoft.DotNet.Interactive.IKernelCommandHandler<Microsoft.DotNet.Interactive.Commands.SubmitCode>, System.IDisposable
public class CSharpKernel : Microsoft.DotNet.Interactive.Kernel, Microsoft.DotNet.Interactive.IKernelCommandHandler<Microsoft.DotNet.Interactive.Commands.RequestCompletions>, Microsoft.DotNet.Interactive.IKernelCommandHandler<Microsoft.DotNet.Interactive.Commands.RequestDiagnostics>, Microsoft.DotNet.Interactive.IKernelCommandHandler<Microsoft.DotNet.Interactive.Commands.RequestHoverText>, Microsoft.DotNet.Interactive.IKernelCommandHandler<Microsoft.DotNet.Interactive.Commands.RequestKernelInfo>, Microsoft.DotNet.Interactive.IKernelCommandHandler<Microsoft.DotNet.Interactive.Commands.RequestSignatureHelp>, Microsoft.DotNet.Interactive.IKernelCommandHandler<Microsoft.DotNet.Interactive.Commands.RequestValue>, Microsoft.DotNet.Interactive.IKernelCommandHandler<Microsoft.DotNet.Interactive.Commands.RequestValueInfos>, Microsoft.DotNet.Interactive.IKernelCommandHandler<Microsoft.DotNet.Interactive.Commands.SendValue>, Microsoft.DotNet.Interactive.IKernelCommandHandler<Microsoft.DotNet.Interactive.Commands.SubmitCode>, System.IDisposable
.ctor()
.ctor(System.String name)
public Microsoft.CodeAnalysis.Scripting.ScriptState ScriptState { get;}
Expand Down
8 changes: 1 addition & 7 deletions src/Microsoft.DotNet.Interactive.CSharp/CSharpKernel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ public class CSharpKernel :
IKernelCommandHandler<RequestValue>,
IKernelCommandHandler<RequestValueInfos>,
IKernelCommandHandler<SendValue>,
IKernelCommandHandler<SubmitCode>,
IKernelCommandHandler<ChangeWorkingDirectory>
IKernelCommandHandler<SubmitCode>
{
internal const string DefaultKernelName = "csharp";

Expand Down Expand Up @@ -348,11 +347,6 @@ await RunAsync(
}
}

Task IKernelCommandHandler<ChangeWorkingDirectory>.HandleAsync(ChangeWorkingDirectory command, KernelInvocationContext context)
{
return Task.CompletedTask;
}

private async Task RunAsync(
string code,
CancellationToken cancellationToken = default,
Expand Down
10 changes: 0 additions & 10 deletions src/Microsoft.DotNet.Interactive.FSharp/FSharpKernel.fs
Original file line number Diff line number Diff line change
Expand Up @@ -186,12 +186,6 @@ type FSharpKernel () as this =
let errorId = sprintf "FS%04i" error.ErrorNumber
Diagnostic(linePositionSpan, severity, errorId, error.Message)

let handleChangeWorkingDirectory (changeDirectory: ChangeWorkingDirectory) (context: KernelInvocationContext) =
task {
this.workingDirectory <- changeDirectory.WorkingDirectory;
return Task.CompletedTask;
}

let handleSubmitCode (codeSubmission: SubmitCode) (context: KernelInvocationContext) =
task {
let codeSubmissionReceived = CodeSubmissionReceived(codeSubmission)
Expand Down Expand Up @@ -460,7 +454,3 @@ type FSharpKernel () as this =

interface IKernelCommandHandler<SubmitCode> with
member this.HandleAsync(command: SubmitCode, context: KernelInvocationContext) = handleSubmitCode command context

interface IKernelCommandHandler<ChangeWorkingDirectory> with
member this.HandleAsync(command: ChangeWorkingDirectory, context: KernelInvocationContext) = handleChangeWorkingDirectory command context

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,6 @@ public static IEnumerable<object[]> Commands()

IEnumerable<KernelCommand> commands()
{
yield return new ChangeWorkingDirectory("/path/to/somewhere");

yield return new DisplayError("oops!");

yield return new DisplayValue(
Expand Down Expand Up @@ -392,10 +390,6 @@ IEnumerable<KernelEvent> events()
new FormattedValue("text/plain", "123")
});

yield return new WorkingDirectoryChanged(
"some/different/directory",
new ChangeWorkingDirectory("some/different/directory"));

yield return new KernelExtensionLoaded(new SubmitCode(@"#r ""nuget:package"" "));

yield return new ValueInfosProduced(new[]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,31 +68,4 @@ public async Task it_can_load_script_files_using_load_directive_with_relative_pa
KernelEvents.Should()
.ContainSingle<DisplayedValueProduced>(e => e.FormattedValues.Any(v => v.Value.Contains("hello!")));
}

[Theory]
[InlineData(Language.CSharp)]
//Not implemented: [InlineData(Language.FSharp)]
public async Task it_can_load_script_files_using_load_directive_with_relative_path_after_command_changeWorkingDirectory(Language language)
{
var currentDirectory = Directory.GetCurrentDirectory();
DisposeAfterTest(() => Directory.SetCurrentDirectory(currentDirectory));

var kernel = CreateKernel(language);
var absolutePathOneLevelHigher = Directory.GetParent(currentDirectory).FullName;
await kernel.SendAsync(new ChangeWorkingDirectory(absolutePathOneLevelHigher));

var relativePath = Path.GetRelativePath(absolutePathOneLevelHigher, currentDirectory);

var code = language switch
{
Language.CSharp => $"#load \"{Path.Combine(relativePath, "RelativeLoadingSample.csx")}\"",
Language.FSharp => $"#load \"{Path.Combine(relativePath, "RelativeLoadingSample.fsx")}\""
};

var command = new SubmitCode(code);
await kernel.SendAsync(command);

KernelEvents.Should()
.ContainSingle<DisplayedValueProduced>(e => e.FormattedValues.Any(v => v.Value.Contains("hello!")));
}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ public static void RegisterDefaults()
{
_envelopeTypesByCommandTypeName = new ConcurrentDictionary<string, Type>
{
[nameof(ChangeWorkingDirectory)] = typeof(KernelCommandEnvelope<ChangeWorkingDirectory>),
[nameof(DisplayError)] = typeof(KernelCommandEnvelope<DisplayError>),
[nameof(DisplayValue)] = typeof(KernelCommandEnvelope<DisplayValue>),
[nameof(RequestCompletions)] = typeof(KernelCommandEnvelope<RequestCompletions>),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ public static void RegisterDefaults()
[nameof(SignatureHelpProduced)] = typeof(KernelEventEnvelope<SignatureHelpProduced>),
[nameof(StandardErrorValueProduced)] = typeof(KernelEventEnvelope<StandardErrorValueProduced>),
[nameof(StandardOutputValueProduced)] = typeof(KernelEventEnvelope<StandardOutputValueProduced>),
[nameof(WorkingDirectoryChanged)] = typeof(KernelEventEnvelope<WorkingDirectoryChanged>),
[nameof(KernelExtensionLoaded)] = typeof(KernelEventEnvelope<KernelExtensionLoaded>),
[nameof(ValueInfosProduced)] = typeof(KernelEventEnvelope<ValueInfosProduced>),
[nameof(ValueProduced)] = typeof(KernelEventEnvelope<ValueProduced>)
Expand Down
17 changes: 0 additions & 17 deletions src/Microsoft.DotNet.Interactive/Events/WorkingDirectoryChanged.cs

This file was deleted.

4 changes: 0 additions & 4 deletions src/Microsoft.DotNet.Interactive/Kernel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -823,10 +823,6 @@ private void TrySetHandler(
SetHandler(requestValueInfos, requestValueInfosHandler);
break;

case (ChangeWorkingDirectory changeWorkingDirectory, IKernelCommandHandler<ChangeWorkingDirectory> changeWorkingDirectoryHandler):
SetHandler(changeWorkingDirectory, changeWorkingDirectoryHandler);
break;

case (RequestKernelInfo requestKernelInfo, IKernelCommandHandler<RequestKernelInfo> requestKernelInfoHandler):
SetHandler(requestKernelInfo, requestKernelInfoHandler);
break;
Expand Down
8 changes: 0 additions & 8 deletions src/dotnet-interactive/Pocket/Format.CustomizeLogString.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,6 @@ private static void AppendLogString(this TextWriter writer, KernelCommand comman

switch (command)
{
case ChangeWorkingDirectory changeWorkingDirectory:
writer.Write(changeWorkingDirectory.WorkingDirectory.TruncateIfNeeded());
break;

case DisplayError displayError:
writer.Write(displayError.Message.TruncateIfNeeded());
break;
Expand Down Expand Up @@ -246,10 +242,6 @@ private static void AppendLogString(this TextWriter writer, KernelEvent @event)
writer.Write(')');
break;

case WorkingDirectoryChanged workingDirectoryChanged:
writer.Write(workingDirectoryChanged.WorkingDirectory.TruncateIfNeeded());
break;

// Base event types.
case DisplayEvent displayEvent:
writer.Write('\'');
Expand Down
14 changes: 1 addition & 13 deletions src/polyglot-notebooks/src/contracts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
// --------------------------------------------- Kernel Commands

export const CancelType = "Cancel";
export const ChangeWorkingDirectoryType = "ChangeWorkingDirectory";
export const CompileProjectType = "CompileProject";
export const DisplayErrorType = "DisplayError";
export const DisplayValueType = "DisplayValue";
Expand All @@ -28,7 +27,6 @@ export const UpdateDisplayedValueType = "UpdateDisplayedValue";

export type KernelCommandType =
typeof CancelType
| typeof ChangeWorkingDirectoryType
| typeof CompileProjectType
| typeof DisplayErrorType
| typeof DisplayValueType
Expand Down Expand Up @@ -57,10 +55,6 @@ export interface KernelCommand {
destinationUri?: string;
}

export interface ChangeWorkingDirectory extends KernelCommand {
workingDirectory: string;
}

export interface CompileProject extends KernelCommand {
}

Expand Down Expand Up @@ -232,7 +226,6 @@ export const StandardErrorValueProducedType = "StandardErrorValueProduced";
export const StandardOutputValueProducedType = "StandardOutputValueProduced";
export const ValueInfosProducedType = "ValueInfosProduced";
export const ValueProducedType = "ValueProduced";
export const WorkingDirectoryChangedType = "WorkingDirectoryChanged";

export type KernelEventType =
typeof AssemblyProducedType
Expand All @@ -259,8 +252,7 @@ export type KernelEventType =
| typeof StandardErrorValueProducedType
| typeof StandardOutputValueProducedType
| typeof ValueInfosProducedType
| typeof ValueProducedType
| typeof WorkingDirectoryChangedType;
| typeof ValueProducedType;

export interface AssemblyProduced extends KernelEvent {
assembly: Base64EncodedAssembly;
Expand Down Expand Up @@ -371,10 +363,6 @@ export interface ValueProduced extends KernelEvent {
formattedValue: FormattedValue;
}

export interface WorkingDirectoryChanged extends KernelEvent {
workingDirectory: string;
}

// --------------------------------------------- Required Types

export interface Base64EncodedAssembly {
Expand Down