mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-29 09:35:38 -05:00
* Start single client session based on the default kernel or saved kernel in NB. * Added kernel displayName to standardKernel. Modified name to allign wtih Juptyer Kernel.name. So we can show the displayName during startup and use the name to start the session. * Change session.OnSessionReady event in KernelDropDown * Added model.KernelChnaged for switching kernel in the same provider * Fixed session.Ready sequence * Fixed merge issues * Solve merged issue * Fixed wrong kernel name in saved NB * Added new event in Model to notify kernel change. Toolbar depends on ModelReady to load * Change attachTo to wait for ModelReady like KenelDropDown * sanitizeSavedKernelInfo to fix invalid kernel and display_name. For example: PySpark1111 and PySpark 1111 * Added _contextsChangingEmitter to change loadContext msg when changing kernel * Resolve PR comments
This commit is contained in:
@@ -52,6 +52,9 @@ let notebookProviderType: IJSONSchema = {
|
||||
name: {
|
||||
type: 'string',
|
||||
},
|
||||
displayName: {
|
||||
type: 'string',
|
||||
},
|
||||
connectionProviderIds: {
|
||||
type: 'array',
|
||||
items: {
|
||||
|
||||
@@ -175,6 +175,7 @@ export class NotebookService extends Disposable implements INotebookService {
|
||||
if (provider) {
|
||||
this._providerToStandardKernels.set(notebookConstants.SQL, [{
|
||||
name: notebookConstants.SQL,
|
||||
displayName: notebookConstants.SQL,
|
||||
connectionProviderIds: sqlConnectionTypes
|
||||
}]);
|
||||
}
|
||||
@@ -451,7 +452,7 @@ export class NotebookService extends Disposable implements INotebookService {
|
||||
notebookRegistry.registerNotebookProvider({
|
||||
provider: sqlProvider.providerId,
|
||||
fileExtensions: DEFAULT_NOTEBOOK_FILETYPE,
|
||||
standardKernels: { name: 'SQL', connectionProviderIds: ['MSSQL'] }
|
||||
standardKernels: { name: notebookConstants.SQL, displayName: notebookConstants.SQL, connectionProviderIds: [notebookConstants.SQL_CONNECTION_PROVIDER] }
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -6,13 +6,14 @@
|
||||
'use strict';
|
||||
|
||||
import { nb } from 'azdata';
|
||||
import * as vscode from 'vscode';
|
||||
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { INotebookManager, SQL_NOTEBOOK_PROVIDER } from 'sql/workbench/services/notebook/common/notebookService';
|
||||
import { SQL_NOTEBOOK_PROVIDER } from 'sql/workbench/services/notebook/common/notebookService';
|
||||
import { LocalContentManager } from 'sql/workbench/services/notebook/node/localContentManager';
|
||||
import { SqlSessionManager } from 'sql/workbench/services/notebook/sql/sqlSessionManager';
|
||||
|
||||
export class SqlNotebookManager implements INotebookManager {
|
||||
export class SqlNotebookManager implements nb.NotebookProvider {
|
||||
private _contentManager: nb.ContentManager;
|
||||
private _sessionManager: nb.SessionManager;
|
||||
|
||||
@@ -36,4 +37,16 @@ export class SqlNotebookManager implements INotebookManager {
|
||||
public get sessionManager(): nb.SessionManager {
|
||||
return this._sessionManager;
|
||||
}
|
||||
|
||||
getNotebookManager(notebookUri: vscode.Uri): Thenable<nb.NotebookManager> {
|
||||
throw new Error('Method not implemented.');
|
||||
}
|
||||
|
||||
handleNotebookClosed(notebookUri: vscode.Uri): void {
|
||||
throw new Error('Method not implemented.');
|
||||
}
|
||||
|
||||
public get standardKernels(): nb.IStandardKernel[] {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
@@ -8,7 +8,7 @@ import * as os from 'os';
|
||||
import { nb, QueryExecuteSubsetResult, IDbColumn, BatchSummary, IResultMessage, ResultSetSummary } from 'azdata';
|
||||
import { localize } from 'vs/nls';
|
||||
import * as strings from 'vs/base/common/strings';
|
||||
import { FutureInternal, ILanguageMagic } from 'sql/parts/notebook/models/modelInterfaces';
|
||||
import { FutureInternal, ILanguageMagic, notebookConstants } from 'sql/parts/notebook/models/modelInterfaces';
|
||||
import QueryRunner, { EventType } from 'sql/platform/query/common/queryRunner';
|
||||
import { IConnectionManagementService } from 'sql/platform/connection/common/connectionManagement';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
@@ -24,18 +24,11 @@ import { elapsedTimeLabel } from 'sql/parts/query/common/localizedConstants';
|
||||
import * as notebookUtils from 'sql/parts/notebook/notebookUtils';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
|
||||
export const sqlKernel: string = localize('sqlKernel', "SQL");
|
||||
export const sqlKernelError: string = localize('sqlKernelError', "SQL kernel error");
|
||||
export const sqlKernelError: string = localize("sqlKernelError", "SQL kernel error");
|
||||
export const MAX_ROWS = 5000;
|
||||
export const NotebookConfigSectionName = 'notebook';
|
||||
export const MaxTableRowsConfigName = 'maxTableRows';
|
||||
|
||||
const sqlKernelSpec: nb.IKernelSpec = ({
|
||||
name: sqlKernel,
|
||||
language: 'sql',
|
||||
display_name: sqlKernel
|
||||
});
|
||||
|
||||
const languageMagics: ILanguageMagic[] = [{
|
||||
language: 'Python',
|
||||
magic: 'lang_python'
|
||||
@@ -65,8 +58,8 @@ export class SqlSessionManager implements nb.SessionManager {
|
||||
|
||||
public get specs(): nb.IAllKernels {
|
||||
let allKernels: nb.IAllKernels = {
|
||||
defaultKernel: sqlKernel,
|
||||
kernels: [sqlKernelSpec]
|
||||
defaultKernel: notebookConstants.sqlKernel,
|
||||
kernels: [notebookConstants.sqlKernelSpec]
|
||||
};
|
||||
return allKernels;
|
||||
}
|
||||
@@ -176,7 +169,7 @@ class SqlKernel extends Disposable implements nb.IKernel {
|
||||
}
|
||||
|
||||
public get name(): string {
|
||||
return sqlKernel;
|
||||
return notebookConstants.sqlKernel;
|
||||
}
|
||||
|
||||
public get supportsIntellisense(): boolean {
|
||||
@@ -217,7 +210,7 @@ class SqlKernel extends Disposable implements nb.IKernel {
|
||||
}
|
||||
|
||||
getSpec(): Thenable<nb.IKernelSpec> {
|
||||
return Promise.resolve(sqlKernelSpec);
|
||||
return Promise.resolve(notebookConstants.sqlKernelSpec);
|
||||
}
|
||||
|
||||
requestExecute(content: nb.IExecuteRequest, disposeOnDone?: boolean): nb.IFuture {
|
||||
|
||||
Reference in New Issue
Block a user