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');
|
||||
|
||||
// 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);
|
||||
|
||||
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);
|
||||
|
||||
// All
|
||||
|
|
|
@ -113,6 +113,7 @@ export interface IInitData {
|
|||
autoStart: boolean;
|
||||
remote: { isRemote: boolean; authority: string | undefined; connectionData: IRemoteConnectionData | null; };
|
||||
uiKind: UIKind;
|
||||
messagePorts?: ReadonlyMap<string, MessagePort>;
|
||||
}
|
||||
|
||||
export interface IConfigurationInitData extends IConfigurationData {
|
||||
|
@ -2253,7 +2254,7 @@ export const MainContext = {
|
|||
MainThreadTheming: createMainId<MainThreadThemingShape>('MainThreadTheming'),
|
||||
MainThreadTunnelService: createMainId<MainThreadTunnelServiceShape>('MainThreadTunnelService'),
|
||||
MainThreadTimeline: createMainId<MainThreadTimelineShape>('MainThreadTimeline'),
|
||||
MainThreadTesting: createMainId<MainThreadTestingShape>('MainThreadTesting')
|
||||
MainThreadTesting: createMainId<MainThreadTestingShape>('MainThreadTesting'),
|
||||
};
|
||||
|
||||
export const ExtHostContext = {
|
||||
|
|
|
@ -447,7 +447,8 @@ export abstract class AbstractExtHostExtensionService extends Disposable impleme
|
|||
checkProposedApiEnabled(extensionDescription, '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
|
||||
// with the worker extension host
|
||||
await barrier.wait();
|
||||
|
|
|
@ -45,7 +45,8 @@ export class ExtensionHostMain {
|
|||
protocol: IMessagePassingProtocol,
|
||||
initData: IInitData,
|
||||
hostUtils: IHostUtils,
|
||||
uriTransformer: IURITransformer | null
|
||||
uriTransformer: IURITransformer | null,
|
||||
messagePorts?: ReadonlyMap<string, MessagePort>
|
||||
) {
|
||||
this._isTerminating = false;
|
||||
this._hostUtils = hostUtils;
|
||||
|
@ -56,7 +57,7 @@ export class ExtensionHostMain {
|
|||
|
||||
// bootstrap services
|
||||
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(IURITransformerService, new URITransformerService(uriTransformer));
|
||||
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',
|
||||
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',
|
||||
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',
|
||||
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',
|
||||
|
|
|
@ -219,9 +219,12 @@ function connectToRenderer(protocol: IMessagePassingProtocol): Promise<IRenderer
|
|||
|
||||
let onTerminate = (reason: string) => nativeClose();
|
||||
|
||||
export function create(): void {
|
||||
const res = new ExtensionWorker();
|
||||
export function create(): { onmessage: (message: any) => void } {
|
||||
performance.mark(`code/extHost/willConnectToRenderer`);
|
||||
|
||||
return {
|
||||
onmessage(messagePorts: ReadonlyMap<string, MessagePort>) {
|
||||
const res = new ExtensionWorker();
|
||||
connectToRenderer(res.protocol).then(data => {
|
||||
performance.mark(`code/extHost/didWaitForInitData`);
|
||||
const extHostMain = new ExtensionHostMain(
|
||||
|
@ -229,8 +232,11 @@ export function create(): void {
|
|||
data.initData,
|
||||
hostUtil,
|
||||
null,
|
||||
messagePorts
|
||||
);
|
||||
|
||||
onTerminate = (reason: string) => extHostMain.terminate(reason);
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
@ -525,6 +525,13 @@ interface IWorkbenchConstructionOptions {
|
|||
//#endregion
|
||||
|
||||
|
||||
//#region IPC
|
||||
|
||||
readonly messagePorts?: ReadonlyMap<ExtensionId, MessagePort>;
|
||||
|
||||
//#endregion
|
||||
|
||||
|
||||
//#region Development options
|
||||
|
||||
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