Fix #3875 Notebook stuck Loading Kernels if SQL flag disabled and Jupyter not installed (#3876)

This commit is contained in:
Kevin Cunnane
2019-02-01 10:10:21 -08:00
committed by GitHub
parent afb6e6b5ba
commit 9504ede1f3
3 changed files with 10 additions and 4 deletions

View File

@@ -3,7 +3,7 @@
"description": "Defines the Data-procotol based Notebook contribution and many Notebook commands and contributions.", "description": "Defines the Data-procotol based Notebook contribution and many Notebook commands and contributions.",
"notebook.configuration.title": "Notebook configuration", "notebook.configuration.title": "Notebook configuration",
"notebook.pythonPath.description": "Local path to python installation used by Notebooks.", "notebook.pythonPath.description": "Local path to python installation used by Notebooks.",
"notebook.sqlKernelEnabled.description": "Enable SQL kernel in notebook editor (Preview)", "notebook.sqlKernelEnabled.description": "Enable SQL kernel in notebook editor (Preview). Requires reloading this window to take effect",
"notebook.command.new": "New Notebook", "notebook.command.new": "New Notebook",
"notebook.command.open": "Open Notebook" "notebook.command.open": "Open Notebook"
} }

View File

@@ -93,7 +93,13 @@ export class NotebookModel extends Disposable implements INotebookModel {
} }
public get notebookManager(): INotebookManager { public get notebookManager(): INotebookManager {
return this.notebookManagers.find(manager => manager.providerId === this._providerId); let manager = this.notebookManagers.find(manager => manager.providerId === this._providerId);
if (!manager) {
// Note: this seems like a less than ideal scenario. We should ideally pass in the "correct" provider ID and allow there to be a default,
// instead of assuming in the NotebookModel constructor that the option is either SQL or Jupyter
manager = this.notebookManagers.find(manager => manager.providerId === DEFAULT_NOTEBOOK_PROVIDER);
}
return manager;
} }
public get notebookUri(): URI { public get notebookUri(): URI {

View File

@@ -17,7 +17,7 @@ import {
import { RenderMimeRegistry } from 'sql/parts/notebook/outputs/registry'; import { RenderMimeRegistry } from 'sql/parts/notebook/outputs/registry';
import { standardRendererFactories } from 'sql/parts/notebook/outputs/factories'; import { standardRendererFactories } from 'sql/parts/notebook/outputs/factories';
import { LocalContentManager } from 'sql/workbench/services/notebook/node/localContentManager'; import { LocalContentManager } from 'sql/workbench/services/notebook/node/localContentManager';
import { SessionManager } from 'sql/workbench/services/notebook/common/sessionManager'; import { SessionManager, noKernel } from 'sql/workbench/services/notebook/common/sessionManager';
import { Extensions, INotebookProviderRegistry, NotebookProviderRegistration } from 'sql/workbench/services/notebook/common/notebookRegistry'; import { Extensions, INotebookProviderRegistry, NotebookProviderRegistration } from 'sql/workbench/services/notebook/common/notebookRegistry';
import { Emitter, Event } from 'vs/base/common/event'; import { Emitter, Event } from 'vs/base/common/event';
import { Memento } from 'vs/workbench/common/memento'; import { Memento } from 'vs/workbench/common/memento';
@@ -359,7 +359,7 @@ export class NotebookService extends Disposable implements INotebookService {
notebookRegistry.registerNotebookProvider({ notebookRegistry.registerNotebookProvider({
provider: defaultProvider.providerId, provider: defaultProvider.providerId,
fileExtensions: DEFAULT_NOTEBOOK_FILETYPE, fileExtensions: DEFAULT_NOTEBOOK_FILETYPE,
standardKernels: [] standardKernels: { name: noKernel, connectionProviderIds: [] }
}); });
} else { } else {
let sqlProvider = new SqlNotebookProvider(this._instantiationService); let sqlProvider = new SqlNotebookProvider(this._instantiationService);