mirror of
https://github.com/microsoft/vscode.git
synced 2026-05-08 17:19:48 +01:00
Revert "experiment running notebooks in dedicated process."
This reverts commit 24344687a2.
This commit is contained in:
@@ -198,13 +198,6 @@ Registry.as<IConfigurationRegistry>(ConfigurationExtensions.Configuration)
|
||||
'pub.name': false
|
||||
}
|
||||
},
|
||||
'extensions.experimental.dedicatedNotebookProcess': {
|
||||
type: 'boolean',
|
||||
description: localize('extensionsExperimentalDedicatedNotebookProcess', "Experimental. When enabled, notebook extensions would run in dedicated extension host."),
|
||||
default: false,
|
||||
scope: ConfigurationScope.APPLICATION,
|
||||
ignoreSync: true
|
||||
},
|
||||
[WORKSPACE_TRUST_EXTENSION_SUPPORT]: {
|
||||
type: 'object',
|
||||
scope: ConfigurationScope.APPLICATION,
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { localize } from 'vs/nls';
|
||||
import { Disposable, DisposableStore, dispose, IDisposable } from 'vs/base/common/lifecycle';
|
||||
import { Action2, registerAction2 } from 'vs/platform/actions/common/actions';
|
||||
import { ServicesAccessor } from 'vs/platform/instantiation/common/instantiation';
|
||||
@@ -13,9 +12,6 @@ import { registerNotebookContribution } from 'vs/workbench/contrib/notebook/brow
|
||||
import { NotebookEditorWidget } from 'vs/workbench/contrib/notebook/browser/notebookEditorWidget';
|
||||
import { INotebookService } from 'vs/workbench/contrib/notebook/common/notebookService';
|
||||
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
import { ICommandService } from 'vs/platform/commands/common/commands';
|
||||
import { ReloadWindowAction } from 'vs/workbench/browser/actions/windowActions';
|
||||
|
||||
export class TroubleshootController extends Disposable implements INotebookEditorContribution {
|
||||
static id: string = 'workbench.notebook.troubleshoot';
|
||||
@@ -150,21 +146,3 @@ registerAction2(class extends Action2 {
|
||||
notebookService.clearEditorCache();
|
||||
}
|
||||
});
|
||||
|
||||
registerAction2(class DedicatedExtensionHostAction extends Action2 {
|
||||
constructor() {
|
||||
super({
|
||||
id: 'notebook.experiment.runInDedicatedExtensionHost',
|
||||
title: localize('notebook.experiment.runInDedicatedExtensionHost', 'Run Notebook Extensions In Dedicated Extension Host'),
|
||||
f1: true,
|
||||
category: CATEGORIES.Developer
|
||||
});
|
||||
}
|
||||
|
||||
async run(accessor: ServicesAccessor) {
|
||||
const service = accessor.get(IConfigurationService);
|
||||
const commandService = accessor.get(ICommandService);
|
||||
await service.updateValue('extensions.experimental.dedicatedNotebookProcess', true);
|
||||
await commandService.executeCommand(ReloadWindowAction.ID);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -188,7 +188,6 @@ export abstract class AbstractExtensionService extends Disposable implements IEx
|
||||
super();
|
||||
|
||||
this._runningLocationClassifier = new ExtensionRunningLocationClassifier(
|
||||
_configurationService,
|
||||
(extension) => this._getExtensionKind(extension),
|
||||
(extensionId, extensionKinds, isInstalledLocally, isInstalledRemotely, preference) => this._pickRunningLocation(extensionId, extensionKinds, isInstalledLocally, isInstalledRemotely, preference)
|
||||
);
|
||||
@@ -667,11 +666,6 @@ export abstract class AbstractExtensionService extends Disposable implements IEx
|
||||
if (localProcessExtensionHost) {
|
||||
await localProcessExtensionHost.ready();
|
||||
}
|
||||
|
||||
const notebookProcessExtensionHost = this._getExtensionHostManager(ExtensionHostKind.LocalNotebook);
|
||||
if (notebookProcessExtensionHost) {
|
||||
await notebookProcessExtensionHost.ready();
|
||||
}
|
||||
} finally {
|
||||
lock.dispose();
|
||||
}
|
||||
@@ -1102,7 +1096,6 @@ class ExtensionInfo {
|
||||
|
||||
class ExtensionRunningLocationClassifier {
|
||||
constructor(
|
||||
private readonly configurationService: IConfigurationService,
|
||||
private readonly getExtensionKind: (extensionDescription: IExtensionDescription) => ExtensionKind[],
|
||||
private readonly pickRunningLocation: (extensionId: ExtensionIdentifier, extensionKinds: ExtensionKind[], isInstalledLocally: boolean, isInstalledRemotely: boolean, preference: ExtensionRunningPreference) => ExtensionRunningLocation,
|
||||
) {
|
||||
@@ -1134,7 +1127,6 @@ class ExtensionRunningLocationClassifier {
|
||||
localExtensions.forEach((ext) => collectExtension(ext));
|
||||
remoteExtensions.forEach((ext) => collectExtension(ext));
|
||||
|
||||
const isDedicatedNotebookProcessEnabled = this.configurationService.getValue<boolean>('extensions.experimental.dedicatedNotebookProcess');
|
||||
const runningLocation = new Map<string, ExtensionRunningLocation>();
|
||||
allExtensions.forEach((ext) => {
|
||||
const isInstalledLocally = Boolean(ext.local);
|
||||
@@ -1150,9 +1142,7 @@ class ExtensionRunningLocationClassifier {
|
||||
preference = ExtensionRunningPreference.Remote;
|
||||
}
|
||||
|
||||
const location = isDedicatedNotebookProcessEnabled && (ext.local?.desc.categories ?? []).indexOf('Notebooks') >= 0 ? ExtensionRunningLocation.LocalNotebookProcess : this.pickRunningLocation(ext.identifier, ext.kind, isInstalledLocally, isInstalledRemotely, preference);
|
||||
|
||||
runningLocation.set(ext.key, location);
|
||||
runningLocation.set(ext.key, this.pickRunningLocation(ext.identifier, ext.kind, isInstalledLocally, isInstalledRemotely, preference));
|
||||
});
|
||||
|
||||
return runningLocation;
|
||||
|
||||
@@ -39,7 +39,6 @@ export interface IMessage {
|
||||
export const enum ExtensionRunningLocation {
|
||||
None,
|
||||
LocalProcess,
|
||||
LocalNotebookProcess,
|
||||
LocalWebWorker,
|
||||
Remote
|
||||
}
|
||||
@@ -50,8 +49,6 @@ export function extensionRunningLocationToString(location: ExtensionRunningLocat
|
||||
return 'None';
|
||||
case ExtensionRunningLocation.LocalProcess:
|
||||
return 'LocalProcess';
|
||||
case ExtensionRunningLocation.LocalNotebookProcess:
|
||||
return 'NotebookProcess';
|
||||
case ExtensionRunningLocation.LocalWebWorker:
|
||||
return 'LocalWebWorker';
|
||||
case ExtensionRunningLocation.Remote:
|
||||
@@ -113,7 +110,6 @@ export interface IExtensionHostProfile {
|
||||
export const enum ExtensionHostKind {
|
||||
LocalProcess,
|
||||
LocalWebWorker,
|
||||
LocalNotebook,
|
||||
Remote
|
||||
}
|
||||
|
||||
@@ -121,7 +117,6 @@ export function extensionHostKindToString(kind: ExtensionHostKind): string {
|
||||
switch (kind) {
|
||||
case ExtensionHostKind.LocalProcess: return 'LocalProcess';
|
||||
case ExtensionHostKind.LocalWebWorker: return 'LocalWebWorker';
|
||||
case ExtensionHostKind.LocalNotebook: return 'LocalNotebook';
|
||||
case ExtensionHostKind.Remote: return 'Remote';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -231,28 +231,12 @@ export class ExtensionService extends AbstractExtensionService implements IExten
|
||||
return (result.length > 0 ? result[0] : ExtensionRunningLocation.None);
|
||||
}
|
||||
|
||||
/**
|
||||
* FYI.
|
||||
* This is an experiment for running notebook extensions in a dedicated extension host to prevent it from being affected
|
||||
* by starving extension host, or slowing down / blocking other extensions as it performs heavy compution when converting
|
||||
* notebook output data from nbformat to vsbuffer (or vise versa).
|
||||
* It's not an attempt to introduce a generic solution for running abitrary extensions in a dedicated extension host.
|
||||
*/
|
||||
private _isDedicatedNotebookExtensionHostExperimentEnabled() {
|
||||
return this._configurationService.getValue<boolean>('extensions.experimental.dedicatedNotebookProcess');
|
||||
}
|
||||
|
||||
protected _createExtensionHosts(isInitialStart: boolean): IExtensionHost[] {
|
||||
const result: IExtensionHost[] = [];
|
||||
|
||||
const localProcessExtHost = this._instantiationService.createInstance(LocalProcessExtensionHost, ExtensionHostKind.LocalProcess, this._createLocalExtensionHostDataProvider(isInitialStart, ExtensionRunningLocation.LocalProcess));
|
||||
const localProcessExtHost = this._instantiationService.createInstance(LocalProcessExtensionHost, this._createLocalExtensionHostDataProvider(isInitialStart, ExtensionRunningLocation.LocalProcess));
|
||||
result.push(localProcessExtHost);
|
||||
|
||||
if (this._isDedicatedNotebookExtensionHostExperimentEnabled()) {
|
||||
const notebookProcessExtHost = this._instantiationService.createInstance(LocalProcessExtensionHost, ExtensionHostKind.LocalNotebook, this._createLocalExtensionHostDataProvider(isInitialStart, ExtensionRunningLocation.LocalNotebookProcess));
|
||||
result.push(notebookProcessExtHost);
|
||||
}
|
||||
|
||||
if (this._enableLocalWebWorker) {
|
||||
const webWorkerExtHost = this._instantiationService.createInstance(WebWorkerExtensionHost, this._lazyLocalWebWorker, this._createLocalExtensionHostDataProvider(isInitialStart, ExtensionRunningLocation.LocalWebWorker));
|
||||
result.push(webWorkerExtHost);
|
||||
@@ -491,11 +475,10 @@ export class ExtensionService extends AbstractExtensionService implements IExten
|
||||
|
||||
// remove non-UI extensions from the local extensions
|
||||
const localProcessExtensions = filterByRunningLocation(localExtensions, this._runningLocation, ExtensionRunningLocation.LocalProcess);
|
||||
const loaclNotebookProcessExtensions = filterByRunningLocation(localExtensions, this._runningLocation, ExtensionRunningLocation.LocalNotebookProcess);
|
||||
const localWebWorkerExtensions = filterByRunningLocation(localExtensions, this._runningLocation, ExtensionRunningLocation.LocalWebWorker);
|
||||
remoteExtensions = filterByRunningLocation(remoteExtensions, this._runningLocation, ExtensionRunningLocation.Remote);
|
||||
|
||||
const result = this._registry.deltaExtensions(remoteExtensions.concat(localProcessExtensions).concat(loaclNotebookProcessExtensions).concat(localWebWorkerExtensions), []);
|
||||
const result = this._registry.deltaExtensions(remoteExtensions.concat(localProcessExtensions).concat(localWebWorkerExtensions), []);
|
||||
if (result.removedDueToLooping.length > 0) {
|
||||
this._logOrShowMessage(Severity.Error, nls.localize('looping', "The following extensions contain dependency loops and have been disabled: {0}", result.removedDueToLooping.map(e => `'${e.identifier.value}'`).join(', ')));
|
||||
}
|
||||
@@ -520,11 +503,6 @@ export class ExtensionService extends AbstractExtensionService implements IExten
|
||||
localProcessExtensionHost.start(localProcessExtensions.map(extension => extension.identifier).filter(id => this._registry.containsExtension(id)));
|
||||
}
|
||||
|
||||
const localNotebookExtensionHost = this._getExtensionHostManager(ExtensionHostKind.LocalNotebook);
|
||||
if (localNotebookExtensionHost) {
|
||||
localNotebookExtensionHost.start(loaclNotebookProcessExtensions.map(extension => extension.identifier).filter(id => this._registry.containsExtension(id)));
|
||||
}
|
||||
|
||||
const localWebWorkerExtensionHost = this._getExtensionHostManager(ExtensionHostKind.LocalWebWorker);
|
||||
if (localWebWorkerExtensionHost) {
|
||||
localWebWorkerExtensionHost.start(localWebWorkerExtensions.map(extension => extension.identifier).filter(id => this._registry.containsExtension(id)));
|
||||
|
||||
@@ -105,6 +105,7 @@ class ExtensionHostProcess {
|
||||
|
||||
export class LocalProcessExtensionHost implements IExtensionHost {
|
||||
|
||||
public readonly kind = ExtensionHostKind.LocalProcess;
|
||||
public readonly remoteAuthority = null;
|
||||
public readonly lazyStart = false;
|
||||
|
||||
@@ -134,7 +135,6 @@ export class LocalProcessExtensionHost implements IExtensionHost {
|
||||
private readonly _extensionHostLogFile: URI;
|
||||
|
||||
constructor(
|
||||
readonly kind: ExtensionHostKind,
|
||||
private readonly _initDataProvider: ILocalProcessExtensionHostDataProvider,
|
||||
@IWorkspaceContextService private readonly _contextService: IWorkspaceContextService,
|
||||
@INotificationService private readonly _notificationService: INotificationService,
|
||||
|
||||
Reference in New Issue
Block a user