Skip to content

Commit d4661d1

Browse files
authored
kernel connection list (#3810)
* fix SendEditableCode to add after current cell # Conflicts: # src/Microsoft.DotNet.Interactive.Tests/Connection/SerializationTests.Command_contract_has_not_been_broken.approved.SendEditableCode.json * initial work to add support for RecentConnectionList * code cleanup * initial code expansion support * code expansion refinements, remove discoverability kernels * remove a FIX comment * fix file path * account for alternative NuGet cache locations * remove discoverability kernel entries * VS preview bug workaround * fix extension.dib: AddToRootKernel isn't async * handle general command deserialization exceptions * remove obsolete test case for KqlDiscoverabilityKernel * include #r in MRU code expansions when necessary * update API contracts * small rename, a little cleanup * test fix
1 parent b7307f6 commit d4661d1

File tree

94 files changed

+2001
-1002
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

94 files changed

+2001
-1002
lines changed

Diff for: repack.ps1

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
11

22
Push-Location $PSScriptRoot
3+
$ErrorActionPreference = "Stop"
34

45
try
56
{
67
# clean up the previously-cached NuGet packages
7-
Remove-Item -Recurse ~\.nuget\packages\microsoft.dotnet.interactive* -Force
8+
$nugetCachePath = $env:NUGET_HTTP_CACHE_PATH
9+
if (-not $nugetCachePath) {
10+
$nugetCachePath = "~\.nuget\packages"
11+
}
12+
Remove-Item -Recurse "$nugetCachePath\microsoft.dotnet.interactive*" -Force
813

914
# build and pack dotnet-interactive
1015
dotnet clean -c debug

Diff for: src/Microsoft.DotNet.Interactive.ApiCompatibility.Tests/ApiCompatibilityTests.Interactive_api_is_not_changed.approved.txt

+2
Original file line numberDiff line numberDiff line change
@@ -654,6 +654,8 @@ Microsoft.DotNet.Interactive.Events
654654
public Microsoft.DotNet.Interactive.IKernelExtension KernelExtension { get;}
655655
public class KernelInfoProduced : KernelEvent
656656
.ctor(Microsoft.DotNet.Interactive.KernelInfo kernelInfo, Microsoft.DotNet.Interactive.Commands.KernelCommand command)
657+
public System.String ConnectionShortcutCode { get;}
658+
public System.Reflection.Assembly ConnectionSourceAssembly { get;}
657659
public Microsoft.DotNet.Interactive.KernelInfo KernelInfo { get;}
658660
public class KernelReady : KernelEvent
659661
.ctor(Microsoft.DotNet.Interactive.KernelInfo[] kernelInfos)

Diff for: src/Microsoft.DotNet.Interactive.ApiCompatibility.Tests/ApiCompatibilityTests.jupyter_api_is_not_changed.approved.txt

+6
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@ Microsoft.DotNet.Interactive.Jupyter
33
.ctor(Microsoft.DotNet.Interactive.Kernel kernel, System.Reactive.Concurrency.IScheduler scheduler = null)
44
public System.Threading.Tasks.Task Handle(JupyterRequestContext context)
55
protected System.Void OnKernelEventReceived(Microsoft.DotNet.Interactive.Events.KernelEvent event, JupyterRequestContext context)
6+
public class CondaEnvironment, IJupyterEnvironment
7+
public static System.String CondaPath { get;}
8+
public static System.Threading.Tasks.Task<System.Collections.Generic.IReadOnlyCollection<System.String>> GetEnvironmentNamesAsync()
9+
public System.String Name { get; set;}
10+
public System.Threading.Tasks.Task<Microsoft.DotNet.Interactive.Utility.CommandLineResult> ExecuteAsync(System.String command, System.String args, System.IO.DirectoryInfo workingDir = null, System.Nullable<System.TimeSpan> timeout = null)
11+
public System.Diagnostics.Process StartProcess(System.String command, System.String args, System.IO.DirectoryInfo workingDir, System.Action<System.String> output = null, System.Action<System.String> error = null)
612
public class ConnectionInformation
713
public static ConnectionInformation Load(System.IO.FileInfo file)
814
.ctor()

Diff for: src/Microsoft.DotNet.Interactive.ApiCompatibility.Tests/ApiCompatibilityTests.powershell_api_is_not_changed.approved.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ Microsoft.DotNet.Interactive.PowerShell
1212
public class SecretManager
1313
.ctor(PowerShellKernel kernel)
1414
public System.String VaultName { get;}
15-
public System.Void SetSecret(System.String name, System.String value, System.String command = null, System.String source = null)
16-
public System.Boolean TryGetSecret(System.String secretName, ref System.String& value)
15+
public System.Void SetValue(System.String name, System.String value)
16+
public System.Boolean TryGetValue(System.String name, ref System.String& value)
1717
Microsoft.DotNet.Interactive.PowerShell.Commands
1818
public class EnterAzShellCommand : System.Management.Automation.PSCmdlet
1919
.ctor()

Diff for: src/Microsoft.DotNet.Interactive.CSharpProject.Tests/CSharpProjectKernelTests.cs

-2
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@ public class CSharpProjectKernelTests
2727

2828
public CSharpProjectKernelTests(ITestOutputHelper output)
2929
{
30-
CSharpProjectKernel.RegisterEventsAndCommands();
31-
3230
_output = output;
3331
_disposables.Add(_output.SubscribeToPocketLogger());
3432
}

Diff for: src/Microsoft.DotNet.Interactive.CSharpProject.Tests/Microsoft.DotNet.Interactive.CSharpProject.Tests.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
</ItemGroup>
2525

2626
<ItemGroup>
27-
<Compile Include="..\dotnet-interactive\Pocket\Format.CustomizeLogString.cs" Link="Pocket\Format.CustomizeLogString.cs" />
27+
<Compile Include="..\dotnet-interactive\(Pocket)\Logger\Format.CustomizeLogString.cs" Link="Pocket\Format.CustomizeLogString.cs" />
2828
<Compile Include="..\Microsoft.DotNet.Interactive.CSharpProject\%28Recipes%29\AsyncLazy{T}.cs" Link="Utility\AsyncLazy{T}.cs" />
2929
<Compile Include="..\Microsoft.DotNet.Interactive.CSharpProject\(Recipes)\JsonSerializationExtensions.cs" />
3030
</ItemGroup>

Diff for: src/Microsoft.DotNet.Interactive.CSharpProject/CSharpProjectKernel.cs

+21-17
Original file line numberDiff line numberDiff line change
@@ -26,25 +26,21 @@ public class CSharpProjectKernel :
2626
IKernelCommandHandler<RequestSignatureHelp>,
2727
IKernelCommandHandler<SubmitCode>
2828
{
29-
private readonly IPrebuildFinder _prebuildFinder;
30-
private WorkspaceServer _workspaceServer;
31-
private Workspace _workspace;
32-
private Buffer _buffer;
33-
34-
public static void RegisterEventsAndCommands()
29+
static CSharpProjectKernel()
3530
{
3631
// register commands and event with serialization
37-
38-
var commandTypes = typeof(CSharpProjectKernel).Assembly.ExportedTypes
39-
.Where(t => t is { IsAbstract: false, IsInterface: false })
40-
.Where(t => typeof(KernelCommand).IsAssignableFrom(t))
41-
.OrderBy(t => t.Name)
42-
.ToList();
43-
var eventTypes = typeof(CSharpProjectKernel).Assembly.ExportedTypes
44-
.Where(t => t is { IsAbstract: false, IsInterface: false })
45-
.Where(t => typeof(KernelEvent).IsAssignableFrom(t))
46-
.OrderBy(t => t.Name)
47-
.ToList();
32+
var commandTypes = typeof(CSharpProjectKernel)
33+
.Assembly.ExportedTypes
34+
.Where(t => t is { IsAbstract: false, IsInterface: false })
35+
.Where(t => typeof(KernelCommand).IsAssignableFrom(t))
36+
.OrderBy(t => t.Name)
37+
.ToList();
38+
var eventTypes = typeof(CSharpProjectKernel)
39+
.Assembly.ExportedTypes
40+
.Where(t => t is { IsAbstract: false, IsInterface: false })
41+
.Where(t => typeof(KernelEvent).IsAssignableFrom(t))
42+
.OrderBy(t => t.Name)
43+
.ToList();
4844

4945
foreach (var commandType in commandTypes)
5046
{
@@ -57,6 +53,14 @@ public static void RegisterEventsAndCommands()
5753
}
5854
}
5955

56+
private readonly IPrebuildFinder _prebuildFinder;
57+
58+
private WorkspaceServer _workspaceServer;
59+
60+
private Workspace _workspace;
61+
62+
private Buffer _buffer;
63+
6064
public CSharpProjectKernel(string name = "csharp", IPrebuildFinder prebuildFinder = null) : base(name)
6165
{
6266
_prebuildFinder = prebuildFinder;

Diff for: src/Microsoft.DotNet.Interactive.Documents/Jupyter/InteractiveDocumentConverter.cs

-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ internal class InteractiveDocumentConverter : JsonConverter<InteractiveDocument>
4848
break;
4949

5050
default:
51-
5251
reader.Skip();
5352
break;
5453
}

Diff for: src/Microsoft.DotNet.Interactive.Formatting/Formatter.cs

-1
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,6 @@ public static void ResetToDefault()
111111
// In the lists of default formatters, the highest priority ones come first,
112112
// so register those last.
113113

114-
// TODO: (ResetToDefault) remove the need to reverse these
115114
_defaultTypeFormatters.PushRange(((IEnumerable<ITypeFormatter>)TabularDataResourceFormatter.DefaultFormatters).Reverse().ToArray());
116115
_defaultTypeFormatters.PushRange(((IEnumerable<ITypeFormatter>)CsvFormatter.DefaultFormatters).Reverse().ToArray());
117116
_defaultTypeFormatters.PushRange(((IEnumerable<ITypeFormatter>)HtmlFormatter.DefaultFormatters).Reverse().ToArray());

0 commit comments

Comments
 (0)