Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updates for Microsoft.DotNet.Interactive.Documents API stabilization #3169

Merged
merged 1 commit into from
Sep 11, 2023

Conversation

jonsequitur
Copy link
Contributor

No description provided.

IDictionary<string, object>? metadata,
[NotNullWhen(true)] out KernelInfoCollection? kernelInfo)
[NotNullWhen(true)] out KernelInfoCollection? kernelInfos)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this be inlined into the above non-static overload (with all callers switched to calling the non-static overload)? Or can this be made private?

Please ignore the above if we have more callers for the static overload outside the current class.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The static method has internal callers.

@@ -65,7 +65,7 @@ public async IAsyncEnumerable<InteractiveDocument> GetImportsAsync(bool recursiv
{
EnsureImportFieldParserIsInitialized();

if (!TryGetKernelInfoFromMetadata(Metadata, out var kernelInfos))
if (!TryGetKernelInfosFromMetadata(out var kernelInfos))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor nit: This call uses the public instance overload while others below use the static overload. Could we standardize to the same call?

@@ -198,7 +198,7 @@ internal void NormalizeElementKernelNames(KernelInfoCollection kernelInfos)

public string? GetDefaultKernelName()
{
if (TryGetKernelInfoFromMetadata(Metadata, out var kernelInfo))
if (TryGetKernelInfosFromMetadata(Metadata, out var kernelInfo))
{
return kernelInfo.DefaultKernelName;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is the public API missing the remaining heuristics (like checking for kernelspec metadata)

@@ -264,19 +259,23 @@ internal static void MergeKernelInfos(KernelInfoCollection destination, KernelIn
destination.AddRange(source.Where(ki => added.Add(ki.Name)));
}

internal static bool TryGetKernelInfoFromMetadata(
public bool TryGetKernelInfosFromMetadata(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems like a new public API. I don't remember adding this during the sync - was this exposed intentionally?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We discussed this during the sync, that there's currently no way to get the kernel info using the public API, and that it's very useful to have.

@jonsequitur jonsequitur merged commit 34cc09c into dotnet:main Sep 11, 2023
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants