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

Display description in kernel picker #14196

Merged
merged 1 commit into from
Oct 1, 2020
Merged
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
16 changes: 11 additions & 5 deletions src/client/datascience/notebook/kernelProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ class VSCodeNotebookKernelMetadata implements VSCNotebookKernel {
constructor(
public readonly label: string,
public readonly description: string,
public readonly detail: string,
public readonly selection: Readonly<KernelConnectionMetadata>,
public readonly isPreferred: boolean,
private readonly kernelProvider: IKernelProvider
Expand Down Expand Up @@ -109,7 +110,8 @@ export class VSCodeKernelPickerProvider implements NotebookKernelProvider {
const mapped = withInterpreter.map((kernel) => {
return new VSCodeNotebookKernelMetadata(
kernel.label,
kernel.description || kernel.detail || '',
kernel.description || '',
kernel.detail || '',
kernel.selection,
areKernelConnectionsEqual(kernel.selection, preferredKernel),
this.kernelProvider
Expand All @@ -135,7 +137,8 @@ export class VSCodeKernelPickerProvider implements NotebookKernelProvider {
1,
new VSCodeNotebookKernelMetadata(
kernel.label,
kernel.description || kernel.detail || '',
kernel.description || '',
kernel.detail || '',
kernel.selection,
true,
this.kernelProvider
Expand Down Expand Up @@ -163,23 +166,26 @@ export class VSCodeKernelPickerProvider implements NotebookKernelProvider {
return;
} else if (preferredKernel.kind === 'startUsingPythonInterpreter') {
return new VSCodeNotebookKernelMetadata(
preferredKernel.interpreter?.displayName || preferredKernel.interpreter.path,
preferredKernel.interpreter.displayName || preferredKernel.interpreter.path,
'',
preferredKernel.interpreter.path,
preferredKernel,
true,
this.kernelProvider
);
} else if (preferredKernel.kind === 'connectToLiveKernel') {
return new VSCodeNotebookKernelMetadata(
preferredKernel.kernelModel?.display_name || preferredKernel.kernelModel?.name,
preferredKernel.kernelModel?.name,
preferredKernel.kernelModel.display_name || preferredKernel.kernelModel.name,
'',
Copy link

Choose a reason for hiding this comment

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

Maybe I'm missing something but it looks like this change is only making the description an empty string? I thought it was setting it to show the remote kernel information?

Copy link
Author

Choose a reason for hiding this comment

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

Yes, I'm ignoring this for this scenario. Its not meant to happen.
THe likelyhood of the preferred kernel not appearing in the list of kernels is next to nil for Remote kernels.
This is required for local kernels because of the way our code works, unfortunately this is a workaround to a bug in our code (basically when returning all of the kernels, that doesn't contain the same kernel that we get when we ask other code for the preferred kernel).

Again, for remote kernels, this code will not get hit, if it does we have even more bugs and we should fix that & get rid of this hacky work around (I tried it, but seemed too much & didn't seem worth).

Copy link

Choose a reason for hiding this comment

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

Maybe trace an error here?

preferredKernel.kernelModel.name,
preferredKernel,
true,
this.kernelProvider
);
} else {
return new VSCodeNotebookKernelMetadata(
preferredKernel.kernelSpec.display_name,
'',
preferredKernel.kernelSpec.name,
preferredKernel,
true,
Expand Down