Skip to content
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 @@ -25,6 +25,20 @@ export class NbExtensionsPathProvider implements INbExtensionsPathProvider {
}
return Uri.joinPath(Uri.file(sysPrefix), 'share', 'jupyter');
}
case 'startUsingLocalKernelSpec': {
// If the local kernelspec has an associated Python interpreter,
// use the same logic as startUsingPythonInterpreter
if (kernel.kernelConnectionMetadata.interpreter) {
const sysPrefix = await getSysPrefix(kernel.kernelConnectionMetadata.interpreter);
if (!sysPrefix) {
return;
}
return Uri.joinPath(Uri.file(sysPrefix), 'share', 'jupyter');
}
// If no interpreter, we haven't come across scenarios with non-python kernels that use widgets
// & have custom widget sources. If we do, we can implement that as we come across them.
return;
}
default: {
// We haven't come across scenarios with non-python kernels that use widgets
// & have custom widget sources. If we do, we can implement that as we come across them.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,13 @@ import { dispose } from '../../../../platform/common/utils/lifecycle';
id: 'interpreterId'
} as any
});
const localKernelSpecWithPythonInterpreter = LocalKernelSpecConnectionMetadata.create({
id: 'localKernelSpecWithPythonInterpreter',
kernelSpec: mock<IJupyterKernelSpec>(),
interpreter: {
id: 'interpreterId'
} as any
});
const serverProviderHandle = { handle: 'handle', id: 'id', extensionId: '' };
const remoteKernelSpec = RemoteKernelSpecConnectionMetadata.create({
id: '',
Expand Down Expand Up @@ -82,6 +89,15 @@ import { dispose } from '../../../../platform/common/utils/lifecycle';
assert.strictEqual(baseUrl?.toString(), Uri.file(path.join(__dirname, 'share', 'jupyter')).toString());
}
});
test('Returns base url for local kernelspec with python interpreter', async () => {
when(kernel.kernelConnectionMetadata).thenReturn(localKernelSpecWithPythonInterpreter);
const baseUrl = await provider.getNbExtensionsParentPath(instance(kernel));
if (isWeb) {
assert.isUndefined(baseUrl);
} else {
assert.strictEqual(baseUrl?.toString(), Uri.file(path.join(__dirname, 'share', 'jupyter')).toString());
}
});
test('Returns base url for remote kernelspec', async () => {
when(kernel.kernelConnectionMetadata).thenReturn(remoteKernelSpec);
const baseUrl = await provider.getNbExtensionsParentPath(instance(kernel));
Expand Down
Loading