Compare commits
4 commits
main
...
joao/web-i
Author | SHA1 | Date | |
---|---|---|---|
3084b7d7ac | |||
2ff9b87972 | |||
68117af61a | |||
ee541af5df |
|
@ -16,10 +16,12 @@ const { monacoTypecheckTask/* , monacoTypecheckWatchTask */ } = require('./gulpf
|
||||||
const { compileExtensionsTask, watchExtensionsTask, compileExtensionMediaTask } = require('./gulpfile.extensions');
|
const { compileExtensionsTask, watchExtensionsTask, compileExtensionMediaTask } = require('./gulpfile.extensions');
|
||||||
|
|
||||||
// Fast compile for development time
|
// Fast compile for development time
|
||||||
const compileClientTask = task.define('compile-client', task.series(util.rimraf('out'), util.buildWebNodePaths('out'), compilation.compileApiProposalNames(), compilation.compileTask('src', 'out', false)));
|
const compileApiProposalNames = task.define('compile-api-proposal-names', compilation.compileApiProposalNames());
|
||||||
|
const compileClientTask = task.define('compile-client', task.series(util.rimraf('out'), util.buildWebNodePaths('out'), compileApiProposalNames, compilation.compileTask('src', 'out', false)));
|
||||||
gulp.task(compileClientTask);
|
gulp.task(compileClientTask);
|
||||||
|
|
||||||
const watchClientTask = task.define('watch-client', task.series(util.rimraf('out'), util.buildWebNodePaths('out'), task.parallel(compilation.watchTask('out', false), compilation.watchApiProposalNames())));
|
const watchApiProposalNames = task.define('watch-api-proposal-names', compilation.watchApiProposalNames());
|
||||||
|
const watchClientTask = task.define('watch-client', task.series(util.rimraf('out'), util.buildWebNodePaths('out'), task.parallel(compilation.watchTask('out', false), watchApiProposalNames)));
|
||||||
gulp.task(watchClientTask);
|
gulp.task(watchClientTask);
|
||||||
|
|
||||||
// All
|
// All
|
||||||
|
|
|
@ -113,6 +113,7 @@ export interface IInitData {
|
||||||
autoStart: boolean;
|
autoStart: boolean;
|
||||||
remote: { isRemote: boolean; authority: string | undefined; connectionData: IRemoteConnectionData | null; };
|
remote: { isRemote: boolean; authority: string | undefined; connectionData: IRemoteConnectionData | null; };
|
||||||
uiKind: UIKind;
|
uiKind: UIKind;
|
||||||
|
messagePorts?: ReadonlyMap<string, MessagePort>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IConfigurationInitData extends IConfigurationData {
|
export interface IConfigurationInitData extends IConfigurationData {
|
||||||
|
@ -295,7 +296,7 @@ export interface MainThreadTextEditorsShape extends IDisposable {
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface MainThreadTreeViewsShape extends IDisposable {
|
export interface MainThreadTreeViewsShape extends IDisposable {
|
||||||
$registerTreeViewDataProvider(treeViewId: string, options: { showCollapseAll: boolean, canSelectMany: boolean, dragAndDropMimeTypes: string[] | undefined}): Promise<void>;
|
$registerTreeViewDataProvider(treeViewId: string, options: { showCollapseAll: boolean, canSelectMany: boolean, dragAndDropMimeTypes: string[] | undefined }): Promise<void>;
|
||||||
$refresh(treeViewId: string, itemsToRefresh?: { [treeItemHandle: string]: ITreeItem; }): Promise<void>;
|
$refresh(treeViewId: string, itemsToRefresh?: { [treeItemHandle: string]: ITreeItem; }): Promise<void>;
|
||||||
$reveal(treeViewId: string, itemInfo: { item: ITreeItem, parentChain: ITreeItem[] } | undefined, options: IRevealOptions): Promise<void>;
|
$reveal(treeViewId: string, itemInfo: { item: ITreeItem, parentChain: ITreeItem[] } | undefined, options: IRevealOptions): Promise<void>;
|
||||||
$setMessage(treeViewId: string, message: string): void;
|
$setMessage(treeViewId: string, message: string): void;
|
||||||
|
@ -2253,7 +2254,7 @@ export const MainContext = {
|
||||||
MainThreadTheming: createMainId<MainThreadThemingShape>('MainThreadTheming'),
|
MainThreadTheming: createMainId<MainThreadThemingShape>('MainThreadTheming'),
|
||||||
MainThreadTunnelService: createMainId<MainThreadTunnelServiceShape>('MainThreadTunnelService'),
|
MainThreadTunnelService: createMainId<MainThreadTunnelServiceShape>('MainThreadTunnelService'),
|
||||||
MainThreadTimeline: createMainId<MainThreadTimelineShape>('MainThreadTimeline'),
|
MainThreadTimeline: createMainId<MainThreadTimelineShape>('MainThreadTimeline'),
|
||||||
MainThreadTesting: createMainId<MainThreadTestingShape>('MainThreadTesting')
|
MainThreadTesting: createMainId<MainThreadTestingShape>('MainThreadTesting'),
|
||||||
};
|
};
|
||||||
|
|
||||||
export const ExtHostContext = {
|
export const ExtHostContext = {
|
||||||
|
|
|
@ -447,7 +447,8 @@ export abstract class AbstractExtHostExtensionService extends Disposable impleme
|
||||||
checkProposedApiEnabled(extensionDescription, 'extensionRuntime');
|
checkProposedApiEnabled(extensionDescription, 'extensionRuntime');
|
||||||
return that.extensionRuntime;
|
return that.extensionRuntime;
|
||||||
},
|
},
|
||||||
get environmentVariableCollection() { return that._extHostTerminalService.getEnvironmentVariableCollection(extensionDescription); }
|
get environmentVariableCollection() { return that._extHostTerminalService.getEnvironmentVariableCollection(extensionDescription); },
|
||||||
|
messagePort: this._initData.messagePorts?.get(ExtensionIdentifier.toKey(extensionDescription.identifier))
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -295,6 +295,12 @@ export class WebWorkerExtensionHost extends Disposable implements IExtensionHost
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// TODO@joao: let's use this mechanism to invert the regular MessagePort sending.
|
||||||
|
// it is currently being sent from the extension host to the outside. we could
|
||||||
|
// send it in this collection instead
|
||||||
|
const messagePorts = this._environmentService.options?.messagePorts ?? new Map();
|
||||||
|
worker.postMessage(messagePorts as any, [...messagePorts.values()]);
|
||||||
|
|
||||||
// await MessagePort and use it to directly communicate
|
// await MessagePort and use it to directly communicate
|
||||||
// with the worker extension host
|
// with the worker extension host
|
||||||
await barrier.wait();
|
await barrier.wait();
|
||||||
|
|
|
@ -45,7 +45,8 @@ export class ExtensionHostMain {
|
||||||
protocol: IMessagePassingProtocol,
|
protocol: IMessagePassingProtocol,
|
||||||
initData: IInitData,
|
initData: IInitData,
|
||||||
hostUtils: IHostUtils,
|
hostUtils: IHostUtils,
|
||||||
uriTransformer: IURITransformer | null
|
uriTransformer: IURITransformer | null,
|
||||||
|
messagePorts?: ReadonlyMap<string, MessagePort>
|
||||||
) {
|
) {
|
||||||
this._isTerminating = false;
|
this._isTerminating = false;
|
||||||
this._hostUtils = hostUtils;
|
this._hostUtils = hostUtils;
|
||||||
|
@ -56,7 +57,7 @@ export class ExtensionHostMain {
|
||||||
|
|
||||||
// bootstrap services
|
// bootstrap services
|
||||||
const services = new ServiceCollection(...getSingletonServiceDescriptors());
|
const services = new ServiceCollection(...getSingletonServiceDescriptors());
|
||||||
services.set(IExtHostInitDataService, { _serviceBrand: undefined, ...initData });
|
services.set(IExtHostInitDataService, { _serviceBrand: undefined, ...initData, messagePorts });
|
||||||
services.set(IExtHostRpcService, new ExtHostRpcService(this._rpcProtocol));
|
services.set(IExtHostRpcService, new ExtHostRpcService(this._rpcProtocol));
|
||||||
services.set(IURITransformerService, new URITransformerService(uriTransformer));
|
services.set(IURITransformerService, new URITransformerService(uriTransformer));
|
||||||
services.set(IHostUtils, hostUtils);
|
services.set(IHostUtils, hostUtils);
|
||||||
|
|
|
@ -25,6 +25,7 @@ export const allApiProposals = Object.freeze({
|
||||||
fsChunks: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.fsChunks.d.ts',
|
fsChunks: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.fsChunks.d.ts',
|
||||||
inlayHints: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.inlayHints.d.ts',
|
inlayHints: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.inlayHints.d.ts',
|
||||||
inlineCompletions: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.inlineCompletions.d.ts',
|
inlineCompletions: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.inlineCompletions.d.ts',
|
||||||
|
ipc: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.ipc.d.ts',
|
||||||
languageStatus: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.languageStatus.d.ts',
|
languageStatus: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.languageStatus.d.ts',
|
||||||
notebookCellExecutionState: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.notebookCellExecutionState.d.ts',
|
notebookCellExecutionState: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.notebookCellExecutionState.d.ts',
|
||||||
notebookConcatTextDocument: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.notebookConcatTextDocument.d.ts',
|
notebookConcatTextDocument: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.notebookConcatTextDocument.d.ts',
|
||||||
|
|
|
@ -219,18 +219,24 @@ function connectToRenderer(protocol: IMessagePassingProtocol): Promise<IRenderer
|
||||||
|
|
||||||
let onTerminate = (reason: string) => nativeClose();
|
let onTerminate = (reason: string) => nativeClose();
|
||||||
|
|
||||||
export function create(): void {
|
export function create(): { onmessage: (message: any) => void } {
|
||||||
const res = new ExtensionWorker();
|
|
||||||
performance.mark(`code/extHost/willConnectToRenderer`);
|
performance.mark(`code/extHost/willConnectToRenderer`);
|
||||||
connectToRenderer(res.protocol).then(data => {
|
|
||||||
performance.mark(`code/extHost/didWaitForInitData`);
|
|
||||||
const extHostMain = new ExtensionHostMain(
|
|
||||||
data.protocol,
|
|
||||||
data.initData,
|
|
||||||
hostUtil,
|
|
||||||
null,
|
|
||||||
);
|
|
||||||
|
|
||||||
onTerminate = (reason: string) => extHostMain.terminate(reason);
|
return {
|
||||||
});
|
onmessage(messagePorts: ReadonlyMap<string, MessagePort>) {
|
||||||
|
const res = new ExtensionWorker();
|
||||||
|
connectToRenderer(res.protocol).then(data => {
|
||||||
|
performance.mark(`code/extHost/didWaitForInitData`);
|
||||||
|
const extHostMain = new ExtensionHostMain(
|
||||||
|
data.protocol,
|
||||||
|
data.initData,
|
||||||
|
hostUtil,
|
||||||
|
null,
|
||||||
|
messagePorts
|
||||||
|
);
|
||||||
|
|
||||||
|
onTerminate = (reason: string) => extHostMain.terminate(reason);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -525,6 +525,13 @@ interface IWorkbenchConstructionOptions {
|
||||||
//#endregion
|
//#endregion
|
||||||
|
|
||||||
|
|
||||||
|
//#region IPC
|
||||||
|
|
||||||
|
readonly messagePorts?: ReadonlyMap<ExtensionId, MessagePort>;
|
||||||
|
|
||||||
|
//#endregion
|
||||||
|
|
||||||
|
|
||||||
//#region Development options
|
//#region Development options
|
||||||
|
|
||||||
readonly developmentOptions?: IDevelopmentOptions;
|
readonly developmentOptions?: IDevelopmentOptions;
|
||||||
|
|
11
src/vscode-dts/vscode.proposed.ipc.d.ts
vendored
Normal file
11
src/vscode-dts/vscode.proposed.ipc.d.ts
vendored
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
/*---------------------------------------------------------------------------------------------
|
||||||
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
|
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||||
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
declare module 'vscode' {
|
||||||
|
|
||||||
|
export interface ExtensionContext {
|
||||||
|
readonly messagePort: MessagePort | undefined;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue