mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-04 17:23:45 -05:00
Treat Jupyter's Python 3 Ipykernel alias as Python 3. (#18943)
This commit is contained in:
@@ -36,6 +36,7 @@ export const FILE_QUERY_EDITOR_TYPEID = 'workbench.editorInput.fileQueryInput';
|
||||
export const RESOURCE_VIEWER_TYPEID = 'workbench.editorInput.resourceViewerInput';
|
||||
|
||||
export const JUPYTER_PROVIDER_ID = 'jupyter';
|
||||
export const IPYKERNEL_DISPLAY_NAME = 'Python 3 (ipykernel)';
|
||||
export const INTERACTIVE_PROVIDER_ID = 'dotnet-interactive';
|
||||
export const INTERACTIVE_LANGUAGE_MODE = 'dib';
|
||||
export const DEFAULT_NB_LANGUAGE_MODE = 'notebook';
|
||||
|
||||
@@ -39,6 +39,7 @@ import { AddCellEdit, CellOutputEdit, ConvertCellTypeEdit, DeleteCellEdit, MoveC
|
||||
import { IUndoRedoService } from 'vs/platform/undoRedo/common/undoRedo';
|
||||
import { deepClone } from 'vs/base/common/objects';
|
||||
import { DotnetInteractiveLabel } from 'sql/workbench/api/common/notebooks/notebookUtils';
|
||||
import { IPYKERNEL_DISPLAY_NAME } from 'sql/workbench/common/constants';
|
||||
|
||||
/*
|
||||
* Used to control whether a message in a dialog/wizard is displayed as an error,
|
||||
@@ -1345,19 +1346,20 @@ export class NotebookModel extends Disposable implements INotebookModel {
|
||||
private sanitizeSavedKernelInfo(): void {
|
||||
if (this._savedKernelInfo) {
|
||||
let displayName = this._savedKernelInfo.display_name;
|
||||
|
||||
if (this._savedKernelInfo.display_name !== displayName) {
|
||||
this._savedKernelInfo.display_name = displayName;
|
||||
}
|
||||
let standardKernel = this._standardKernels.find(kernel => kernel.displayName === displayName || displayName.startsWith(kernel.displayName));
|
||||
if (standardKernel && this._savedKernelInfo.name && this._savedKernelInfo.name !== standardKernel.name) {
|
||||
// Special case .NET Interactive kernel name to handle inconsistencies between notebook providers and jupyter kernel specs
|
||||
if (this._savedKernelInfo.display_name === DotnetInteractiveLabel) {
|
||||
this._savedKernelInfo.oldName = this._savedKernelInfo.name;
|
||||
}
|
||||
if (standardKernel) {
|
||||
if (this._savedKernelInfo.name && this._savedKernelInfo.name !== standardKernel.name) {
|
||||
// Special case .NET Interactive kernel name to handle inconsistencies between notebook providers and jupyter kernel specs
|
||||
if (this._savedKernelInfo.display_name === DotnetInteractiveLabel) {
|
||||
this._savedKernelInfo.oldName = this._savedKernelInfo.name;
|
||||
}
|
||||
|
||||
this._savedKernelInfo.name = standardKernel.name;
|
||||
this._savedKernelInfo.display_name = standardKernel.displayName;
|
||||
this._savedKernelInfo.name = standardKernel.name;
|
||||
this._savedKernelInfo.display_name = standardKernel.displayName;
|
||||
} else if (displayName === IPYKERNEL_DISPLAY_NAME && this._savedKernelInfo.name === standardKernel.name) {
|
||||
// Handle Jupyter alias for Python 3 kernel
|
||||
this._savedKernelInfo.display_name = standardKernel.displayName;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user