提交 7c593490 编写于 作者: B Benjamin Pasero

sandbox - self invoke functions for shared process, issues and process explorer

上级 5497e60e
......@@ -107,6 +107,10 @@
'vs/nls': nlsConfig
};
// Enable loading of node modules:
// - sandbox: we list paths of webpacked modules to help the loader
// - non-sandbox: we signal that any module that does not begin with
// `vs/` should be loaded using node.js require()
if (sandbox) {
loaderConfig.paths = {
'vscode-textmate': `../node_modules/vscode-textmate/release/main`,
......
......@@ -6,28 +6,40 @@
//@ts-check
'use strict';
/**
* @type {{ load: (modules: string[], resultCallback: (result, configuration: object) => any, options?: object) => unknown }}
*/
const bootstrapWindow = (() => {
// @ts-ignore (defined in bootstrap-window.js)
return window.MonacoBootstrapWindow;
})();
/**
* @type {{ avoidMonkeyPatchFromAppInsights: () => void; }}
*/
const bootstrap = (() => {
// @ts-ignore (defined in bootstrap.js)
return window.MonacoBootstrap;
})();
// Avoid Monkey Patches from Application Insights
bootstrap.avoidMonkeyPatchFromAppInsights();
bootstrapWindow.load(['vs/code/electron-browser/sharedProcess/sharedProcessMain'], function (sharedProcess, configuration) {
sharedProcess.startup({
machineId: configuration.machineId,
windowId: configuration.windowId
(function () {
const bootstrap = bootstrapLib();
const bootstrapWindow = bootstrapWindowLib();
// Avoid Monkey Patches from Application Insights
bootstrap.avoidMonkeyPatchFromAppInsights();
// Load shared process into window
bootstrapWindow.load(['vs/code/electron-browser/sharedProcess/sharedProcessMain'], function (sharedProcess, configuration) {
sharedProcess.startup({
machineId: configuration.machineId,
windowId: configuration.windowId
});
});
});
//#region Globals
/**
* @returns {{ avoidMonkeyPatchFromAppInsights: () => void; }}
*/
function bootstrapLib() {
// @ts-ignore (defined in bootstrap.js)
return window.MonacoBootstrap;
}
/**
* @returns {{ load: (modules: string[], resultCallback: (result, configuration: object) => any, options?: object) => unknown }}
*/
function bootstrapWindowLib() {
// @ts-ignore (defined in bootstrap-window.js)
return window.MonacoBootstrapWindow;
}
//#endregion
}());
......@@ -6,14 +6,24 @@
//@ts-check
'use strict';
/**
* @type {{ load: (modules: string[], resultCallback: (result, configuration: object) => any, options: object) => unknown }}
*/
const bootstrapWindow = (() => {
// @ts-ignore (defined in bootstrap-window.js)
return window.MonacoBootstrapWindow;
})();
(function () {
const bootstrapWindow = bootstrapWindowLib();
bootstrapWindow.load(['vs/code/electron-sandbox/issue/issueReporterMain'], function (issueReporter, configuration) {
issueReporter.startup(configuration);
}, { forceEnableDeveloperKeybindings: true, disallowReloadKeybinding: true });
// Load issue reporter into window
bootstrapWindow.load(['vs/code/electron-sandbox/issue/issueReporterMain'], function (issueReporter, configuration) {
issueReporter.startup(configuration);
}, { forceEnableDeveloperKeybindings: true, disallowReloadKeybinding: true });
//#region Globals
/**
* @returns {{ load: (modules: string[], resultCallback: (result, configuration: object) => any, options?: object) => unknown }}
*/
function bootstrapWindowLib() {
// @ts-ignore (defined in bootstrap-window.js)
return window.MonacoBootstrapWindow;
}
//#endregion
}());
......@@ -6,14 +6,24 @@
//@ts-check
'use strict';
/**
* @type {{ load: (modules: string[], resultCallback: (result, configuration: object) => any, options: object) => unknown }}
*/
const bootstrapWindow = (() => {
// @ts-ignore (defined in bootstrap-window.js)
return window.MonacoBootstrapWindow;
})();
(function () {
const bootstrapWindow = bootstrapWindowLib();
bootstrapWindow.load(['vs/code/electron-sandbox/processExplorer/processExplorerMain'], function (processExplorer, configuration) {
processExplorer.startup(configuration.windowId, configuration.data);
}, { forceEnableDeveloperKeybindings: true });
// Load process explorer into window
bootstrapWindow.load(['vs/code/electron-sandbox/processExplorer/processExplorerMain'], function (processExplorer, configuration) {
processExplorer.startup(configuration.windowId, configuration.data);
}, { forceEnableDeveloperKeybindings: true });
//#region Globals
/**
* @returns {{ load: (modules: string[], resultCallback: (result, configuration: object) => any, options?: object) => unknown }}
*/
function bootstrapWindowLib() {
// @ts-ignore (defined in bootstrap-window.js)
return window.MonacoBootstrapWindow;
}
//#endregion
}());
......@@ -425,6 +425,15 @@ export function startup(windowId: number, data: ProcessExplorerData): void {
document.onkeydown = (e: KeyboardEvent) => {
const cmdOrCtrlKey = data.platform === 'darwin' ? e.metaKey : e.ctrlKey;
// Cmd/Ctrl + w closes issue window
if (cmdOrCtrlKey && e.keyCode === 87) {
e.stopPropagation();
e.preventDefault();
processExplorer.dispose();
ipcRenderer.send('vscode:closeProcessExplorer');
}
// Cmd/Ctrl + zooms in
if (cmdOrCtrlKey && e.keyCode === 187) {
zoomIn();
......@@ -435,13 +444,4 @@ export function startup(windowId: number, data: ProcessExplorerData): void {
zoomOut();
}
};
// Cmd/Ctrl + w closes process explorer
window.addEventListener('keydown', e => {
const cmdOrCtrlKey = data.platform === 'darwin' ? e.metaKey : e.ctrlKey;
if (cmdOrCtrlKey && e.keyCode === 87) {
processExplorer.dispose();
ipcRenderer.send('vscode:closeProcessExplorer');
}
});
}
......@@ -77,7 +77,7 @@ export interface ProcessExplorerStyles extends WindowStyles {
export interface ProcessExplorerData extends WindowData {
pid: number;
styles: ProcessExplorerStyles;
platform: string;
platform: 'win32' | 'darwin' | 'linux';
applicationName: string;
}
......
......@@ -14,7 +14,7 @@ import { getZoomLevel } from 'vs/base/browser/browser';
import { IWorkbenchIssueService } from 'vs/workbench/contrib/issue/electron-sandbox/issue';
import { INativeWorkbenchEnvironmentService } from 'vs/workbench/services/environment/electron-sandbox/environmentService';
import { ExtensionType } from 'vs/platform/extensions/common/extensions';
import { platform, PlatformToString } from 'vs/base/common/platform';
import { process } from 'vs/base/parts/sandbox/electron-sandbox/globals';
import { IProductService } from 'vs/platform/product/common/productService';
export class WorkbenchIssueService implements IWorkbenchIssueService {
......@@ -70,7 +70,7 @@ export class WorkbenchIssueService implements IWorkbenchIssueService {
hoverForeground: getColor(theme, listHoverForeground),
highlightForeground: getColor(theme, listHighlightForeground),
},
platform: PlatformToString(platform),
platform: process.platform,
applicationName: this.productService.applicationName
};
return this.issueService.openProcessExplorer(data);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册