mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-20 17:22:51 -05:00
Merge from vscode e3c4990c67c40213af168300d1cfeb71d680f877 (#16569)
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { flatten, isNonEmptyArray } from 'vs/base/common/arrays';
|
||||
@@ -44,7 +44,7 @@ abstract class MainThreadKernel implements INotebookKernel {
|
||||
|
||||
constructor(data: INotebookKernelDto2, private _modeService: IModeService) {
|
||||
this.id = data.id;
|
||||
this.viewType = data.viewType;
|
||||
this.viewType = data.notebookType;
|
||||
this.extension = data.extensionId;
|
||||
|
||||
this.implementsInterrupt = data.supportsInterrupt ?? false;
|
||||
@@ -52,7 +52,7 @@ abstract class MainThreadKernel implements INotebookKernel {
|
||||
this.description = data.description;
|
||||
this.detail = data.detail;
|
||||
this.supportedLanguages = isNonEmptyArray(data.supportedLanguages) ? data.supportedLanguages : _modeService.getRegisteredModes();
|
||||
this.implementsExecutionOrder = data.hasExecutionOrder ?? false;
|
||||
this.implementsExecutionOrder = data.supportsExecutionOrder ?? false;
|
||||
this.localResourceRoot = URI.revive(data.extensionLocation);
|
||||
this.preloads = data.preloads?.map(u => ({ uri: URI.revive(u.uri), provides: u.provides })) ?? [];
|
||||
}
|
||||
@@ -77,8 +77,8 @@ abstract class MainThreadKernel implements INotebookKernel {
|
||||
this.supportedLanguages = isNonEmptyArray(data.supportedLanguages) ? data.supportedLanguages : this._modeService.getRegisteredModes();
|
||||
event.supportedLanguages = true;
|
||||
}
|
||||
if (data.hasExecutionOrder !== undefined) {
|
||||
this.implementsExecutionOrder = data.hasExecutionOrder;
|
||||
if (data.supportsExecutionOrder !== undefined) {
|
||||
this.implementsExecutionOrder = data.supportsExecutionOrder;
|
||||
event.hasExecutionOrder = true;
|
||||
}
|
||||
this._onDidChange.fire(event);
|
||||
@@ -122,9 +122,6 @@ export class MainThreadNotebookKernels implements MainThreadNotebookKernelsShape
|
||||
private _onEditorAdd(editor: INotebookEditor) {
|
||||
|
||||
const ipcListener = editor.onDidReceiveMessage(e => {
|
||||
if (e.forRenderer) {
|
||||
return;
|
||||
}
|
||||
if (!editor.hasModel()) {
|
||||
return;
|
||||
}
|
||||
@@ -134,7 +131,7 @@ export class MainThreadNotebookKernels implements MainThreadNotebookKernelsShape
|
||||
}
|
||||
for (let [handle, candidate] of this._kernels) {
|
||||
if (candidate[0] === selected) {
|
||||
this._proxy.$acceptRendererMessage(handle, editor.getId(), e.message);
|
||||
this._proxy.$acceptKernelMessageFromRenderer(handle, editor.getId(), e.message);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -164,11 +161,11 @@ export class MainThreadNotebookKernels implements MainThreadNotebookKernelsShape
|
||||
}
|
||||
if (editorId === undefined) {
|
||||
// all editors
|
||||
editor.postMessage(undefined, message);
|
||||
editor.postMessage(message);
|
||||
didSend = true;
|
||||
} else if (editor.getId() === editorId) {
|
||||
// selected editors
|
||||
editor.postMessage(undefined, message);
|
||||
editor.postMessage(message);
|
||||
didSend = true;
|
||||
break;
|
||||
}
|
||||
@@ -188,16 +185,16 @@ export class MainThreadNotebookKernels implements MainThreadNotebookKernelsShape
|
||||
await that._proxy.$cancelCells(handle, uri, handles);
|
||||
}
|
||||
}(data, this._modeService);
|
||||
const registration = this._notebookKernelService.registerKernel(kernel);
|
||||
|
||||
const listener = this._notebookKernelService.onDidChangeNotebookKernelBinding(e => {
|
||||
if (e.oldKernel === kernel.id) {
|
||||
this._proxy.$acceptSelection(handle, e.notebook, false);
|
||||
this._proxy.$acceptNotebookAssociation(handle, e.notebook, false);
|
||||
} else if (e.newKernel === kernel.id) {
|
||||
this._proxy.$acceptSelection(handle, e.notebook, true);
|
||||
this._proxy.$acceptNotebookAssociation(handle, e.notebook, true);
|
||||
}
|
||||
});
|
||||
|
||||
const registration = this._notebookKernelService.registerKernel(kernel);
|
||||
this._kernels.set(handle, [kernel, combinedDisposable(listener, registration)]);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user