chore(vscode): update to 1.56.0

This commit is contained in:
Akash Satheesan
2021-04-30 20:25:17 +05:30
1749 changed files with 88014 additions and 43316 deletions

View File

@@ -11,19 +11,40 @@
// 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
return issueReporter.startup(configuration);
},
{
configureDeveloperSettings: function () {
return {
forceEnableDeveloperKeybindings: true,
disallowReloadKeybinding: true
};
}
}
);
/**
* @returns {{ load: (modules: string[], resultCallback: (result, configuration: object) => any, options?: object) => unknown }}
* @typedef {import('../../../base/parts/sandbox/common/sandboxTypes').ISandboxConfiguration} ISandboxConfiguration
*
* @returns {{
* load: (
* modules: string[],
* resultCallback: (result, configuration: ISandboxConfiguration) => unknown,
* options?: {
* configureDeveloperSettings?: (config: ISandboxConfiguration) => {
* forceEnableDeveloperKeybindings?: boolean,
* disallowReloadKeybinding?: boolean,
* removeDeveloperKeybindingsAfterLoad?: boolean
* },
* canModifyDOM?: (config: ISandboxConfiguration) => void,
* beforeLoaderConfig?: (loaderConfig: object) => void,
* beforeRequire?: () => void
* }
* ) => Promise<unknown>
* }}
*/
function bootstrapWindowLib() {
// @ts-ignore (defined in bootstrap-window.js)
return window.MonacoBootstrapWindow;
}
//#endregion
}());

View File

@@ -11,10 +11,10 @@ import { ipcRenderer } from 'vs/base/parts/sandbox/electron-sandbox/globals';
import { applyZoom, zoomIn, zoomOut } from 'vs/platform/windows/electron-sandbox/window';
import { $, reset, safeInnerHtml, windowOpenNoOpener } from 'vs/base/browser/dom';
import { Button } from 'vs/base/browser/ui/button/button';
import * as collections from 'vs/base/common/collections';
import { groupBy } from 'vs/base/common/collections';
import { debounce } from 'vs/base/common/decorators';
import { Disposable } from 'vs/base/common/lifecycle';
import * as platform from 'vs/base/common/platform';
import { isWindows, isLinux, isLinuxSnap, isMacintosh } from 'vs/base/common/platform';
import { escape } from 'vs/base/common/strings';
import { normalizeGitHubUrl } from 'vs/platform/issue/common/issueReporterUtil';
import { IssueReporterData as IssueReporterModelData, IssueReporterModel } from 'vs/code/electron-sandbox/issue/issueReporterModel';
@@ -23,8 +23,7 @@ import { localize } from 'vs/nls';
import { isRemoteDiagnosticError, SystemInfo } from 'vs/platform/diagnostics/common/diagnostics';
import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection';
import { IMainProcessService } from 'vs/platform/ipc/electron-sandbox/services';
import { IssueReporterData, IssueReporterExtensionData, IssueReporterFeatures, IssueReporterStyles, IssueType } from 'vs/platform/issue/common/issue';
import { IWindowConfiguration } from 'vs/platform/windows/common/windows';
import { IssueReporterWindowConfiguration, IssueReporterData, IssueReporterExtensionData, IssueReporterStyles, IssueType } from 'vs/platform/issue/common/issue';
import { Codicon } from 'vs/base/common/codicons';
import { renderIcon } from 'vs/base/browser/ui/iconLabel/iconLabels';
import { ElectronIPCMainProcessService } from 'vs/platform/ipc/electron-sandbox/mainProcessService';
@@ -43,28 +42,8 @@ enum IssueSource {
Marketplace = 'marketplace'
}
export interface IssueReporterConfiguration extends IWindowConfiguration {
windowId: number;
disableExtensions: boolean;
data: IssueReporterData;
features: IssueReporterFeatures;
os: {
type: string;
arch: string;
release: string;
},
product: {
nameShort: string;
version: string;
commit: string | undefined;
date: string | undefined;
reportIssueUrl: string | undefined;
reportMarketplaceIssueUrl: string | undefined;
}
}
export function startup(configuration: IssueReporterConfiguration) {
const platformClass = platform.isWindows ? 'windows' : platform.isLinux ? 'linux' : 'mac';
export function startup(configuration: IssueReporterWindowConfiguration) {
const platformClass = isWindows ? 'windows' : isLinux ? 'linux' : 'mac';
document.body.classList.add(platformClass); // used by our fonts
safeInnerHtml(document.body, BaseHtml());
@@ -86,7 +65,7 @@ export class IssueReporter extends Disposable {
private readonly previewButton!: Button;
constructor(private readonly configuration: IssueReporterConfiguration) {
constructor(private readonly configuration: IssueReporterWindowConfiguration) {
super();
this.initServices(configuration);
@@ -95,8 +74,8 @@ export class IssueReporter extends Disposable {
this.issueReporterModel = new IssueReporterModel({
issueType: configuration.data.issueType || IssueType.Bug,
versionInfo: {
vscodeVersion: `${configuration.product.nameShort} ${configuration.product.version} (${configuration.product.commit || 'Commit unknown'}, ${configuration.product.date || 'Date unknown'})`,
os: `${this.configuration.os.type} ${this.configuration.os.arch} ${this.configuration.os.release}${platform.isLinuxSnap ? ' snap' : ''}`
vscodeVersion: `${configuration.product.nameShort} ${!!configuration.product.darwinUniversalAssetId ? `${configuration.product.version} (Universal)` : configuration.product.version} (${configuration.product.commit || 'Commit unknown'}, ${configuration.product.date || 'Date unknown'})`,
os: `${this.configuration.os.type} ${this.configuration.os.arch} ${this.configuration.os.release}${isLinuxSnap ? ' snap' : ''}`
},
extensionsDisabled: !!configuration.disableExtensions,
fileOnExtension: configuration.data.extensionId ? !targetExtension?.isBuiltin : undefined,
@@ -257,7 +236,7 @@ export class IssueReporter extends Disposable {
private handleExtensionData(extensions: IssueReporterExtensionData[]) {
const installedExtensions = extensions.filter(x => !x.isBuiltin);
const { nonThemes, themes } = collections.groupBy(installedExtensions, ext => {
const { nonThemes, themes } = groupBy(installedExtensions, ext => {
return ext.isTheme ? 'themes' : 'nonThemes';
});
@@ -272,7 +251,7 @@ export class IssueReporter extends Disposable {
this.updateExtensionSelector(installedExtensions);
}
private initServices(configuration: IssueReporterConfiguration): void {
private initServices(configuration: IssueReporterWindowConfiguration): void {
const serviceCollection = new ServiceCollection();
const mainProcessService = new ElectronIPCMainProcessService(configuration.windowId);
serviceCollection.set(IMainProcessService, mainProcessService);
@@ -400,7 +379,7 @@ export class IssueReporter extends Disposable {
});
document.onkeydown = async (e: KeyboardEvent) => {
const cmdOrCtrlKey = platform.isMacintosh ? e.metaKey : e.ctrlKey;
const cmdOrCtrlKey = isMacintosh ? e.metaKey : e.ctrlKey;
// Cmd/Ctrl+Enter previews issue and closes window
if (cmdOrCtrlKey && e.keyCode === 13) {
if (await this.createIssue()) {
@@ -434,7 +413,7 @@ export class IssueReporter extends Disposable {
// With latest electron upgrade, cmd+a is no longer propagating correctly for inputs in this window on mac
// Manually perform the selection
if (platform.isMacintosh) {
if (isMacintosh) {
if (cmdOrCtrlKey && e.keyCode === 65 && e.target) {
if (e.target instanceof HTMLInputElement || e.target instanceof HTMLTextAreaElement) {
(<HTMLInputElement>e.target).select();

View File

@@ -12,7 +12,7 @@ suite('IssueReporter', () => {
test('sets defaults to include all data', () => {
const issueReporterModel = new IssueReporterModel();
assert.deepEqual(issueReporterModel.getData(), {
assert.deepStrictEqual(issueReporterModel.getData(), {
allExtensions: [],
includeSystemInfo: true,
includeWorkspaceInfo: true,
@@ -25,7 +25,7 @@ suite('IssueReporter', () => {
test('serializes model skeleton when no data is provided', () => {
const issueReporterModel = new IssueReporterModel({});
assert.equal(issueReporterModel.serialize(),
assert.strictEqual(issueReporterModel.serialize(),
`
Issue Type: <b>Bug</b>
@@ -55,7 +55,7 @@ Extensions: none
}
}
});
assert.equal(issueReporterModel.serialize(),
assert.strictEqual(issueReporterModel.serialize(),
`
Issue Type: <b>Bug</b>
@@ -98,7 +98,7 @@ OS version: undefined
},
experimentInfo: 'vsliv695:30137379\nvsins829:30139715'
});
assert.equal(issueReporterModel.serialize(),
assert.strictEqual(issueReporterModel.serialize(),
`
Issue Type: <b>Bug</b>
@@ -152,7 +152,7 @@ vsins829:30139715
}
}
});
assert.equal(issueReporterModel.serialize(),
assert.strictEqual(issueReporterModel.serialize(),
`
Issue Type: <b>Bug</b>
@@ -208,7 +208,7 @@ OS version: undefined
]
}
});
assert.equal(issueReporterModel.serialize(),
assert.strictEqual(issueReporterModel.serialize(),
`
Issue Type: <b>Bug</b>
@@ -256,7 +256,7 @@ Remote OS version: Linux x64 4.18.0
gpuStatus: {}
}
});
assert.equal(issueReporterModel.serialize(),
assert.strictEqual(issueReporterModel.serialize(),
`
Issue Type: <b>Bug</b>
@@ -291,7 +291,7 @@ OS version: undefined
'https://github.com/repo/issues/new',
'https://github.com/repo/issues/new/'
].forEach(url => {
assert.equal('https://github.com/repo', normalizeGitHubUrl(url));
assert.strictEqual('https://github.com/repo', normalizeGitHubUrl(url));
});
});
@@ -306,7 +306,7 @@ OS version: undefined
fileOnExtension: true
});
assert.equal(issueReporterModel.fileOnExtension(), true);
assert.strictEqual(issueReporterModel.fileOnExtension(), true);
});
});
});

View File

@@ -11,19 +11,37 @@
// 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
return processExplorer.startup(configuration);
}, {
configureDeveloperSettings: function () {
return {
forceEnableDeveloperKeybindings: true
};
},
});
/**
* @returns {{ load: (modules: string[], resultCallback: (result, configuration: object) => any, options?: object) => unknown }}
* @typedef {import('../../../base/parts/sandbox/common/sandboxTypes').ISandboxConfiguration} ISandboxConfiguration
*
* @returns {{
* load: (
* modules: string[],
* resultCallback: (result, configuration: ISandboxConfiguration) => unknown,
* options?: {
* configureDeveloperSettings?: (config: ISandboxConfiguration) => {
* forceEnableDeveloperKeybindings?: boolean,
* disallowReloadKeybinding?: boolean,
* removeDeveloperKeybindingsAfterLoad?: boolean
* },
* canModifyDOM?: (config: ISandboxConfiguration) => void,
* beforeLoaderConfig?: (loaderConfig: object) => void,
* beforeRequire?: () => void
* }
* ) => Promise<unknown>
* }}
*/
function bootstrapWindowLib() {
// @ts-ignore (defined in bootstrap-window.js)
return window.MonacoBootstrapWindow;
}
//#endregion
}());

View File

@@ -9,13 +9,12 @@ import { INativeHostService } from 'vs/platform/native/electron-sandbox/native';
import { NativeHostService } from 'vs/platform/native/electron-sandbox/nativeHostService';
import { ipcRenderer } from 'vs/base/parts/sandbox/electron-sandbox/globals';
import { localize } from 'vs/nls';
import { ProcessExplorerStyles, ProcessExplorerData } from 'vs/platform/issue/common/issue';
import { ProcessExplorerStyles, ProcessExplorerData, ProcessExplorerWindowConfiguration } from 'vs/platform/issue/common/issue';
import { applyZoom, zoomIn, zoomOut } from 'vs/platform/windows/electron-sandbox/window';
import { IContextMenuItem } from 'vs/base/parts/contextmenu/common/contextmenu';
import { popup } from 'vs/base/parts/contextmenu/electron-sandbox/contextmenu';
import { ProcessItem } from 'vs/base/common/processes';
import * as dom from 'vs/base/browser/dom';
import { DisposableStore } from 'vs/base/common/lifecycle';
import { append, $ } from 'vs/base/browser/dom';
import { isRemoteDiagnosticError, IRemoteDiagnosticError } from 'vs/platform/diagnostics/common/diagnostics';
import { ElectronIPCMainProcessService } from 'vs/platform/ipc/electron-sandbox/mainProcessService';
import { ByteSize } from 'vs/platform/files/common/files';
@@ -105,11 +104,11 @@ class ProcessHeaderTreeRenderer implements ITreeRenderer<ProcessInformation, voi
templateId: string = 'header';
renderTemplate(container: HTMLElement): IProcessItemTemplateData {
const data = Object.create(null);
const row = dom.append(container, dom.$('.row'));
data.name = dom.append(row, dom.$('.nameLabel'));
data.CPU = dom.append(row, dom.$('.cpu'));
data.memory = dom.append(row, dom.$('.memory'));
data.PID = dom.append(row, dom.$('.pid'));
const row = append(container, $('.row'));
data.name = append(row, $('.nameLabel'));
data.CPU = append(row, $('.cpu'));
data.memory = append(row, $('.memory'));
data.PID = append(row, $('.pid'));
return data;
}
renderElement(node: ITreeNode<ProcessInformation, void>, index: number, templateData: IProcessItemTemplateData, height: number | undefined): void {
@@ -128,8 +127,8 @@ class MachineRenderer implements ITreeRenderer<MachineProcessInformation, void,
templateId: string = 'machine';
renderTemplate(container: HTMLElement): IProcessRowTemplateData {
const data = Object.create(null);
const row = dom.append(container, dom.$('.row'));
data.name = dom.append(row, dom.$('.nameLabel'));
const row = append(container, $('.row'));
data.name = append(row, $('.nameLabel'));
return data;
}
renderElement(node: ITreeNode<MachineProcessInformation, void>, index: number, templateData: IProcessRowTemplateData, height: number | undefined): void {
@@ -144,8 +143,8 @@ class ErrorRenderer implements ITreeRenderer<IRemoteDiagnosticError, void, IProc
templateId: string = 'error';
renderTemplate(container: HTMLElement): IProcessRowTemplateData {
const data = Object.create(null);
const row = dom.append(container, dom.$('.row'));
data.name = dom.append(row, dom.$('.nameLabel'));
const row = append(container, $('.row'));
data.name = append(row, $('.nameLabel'));
return data;
}
renderElement(node: ITreeNode<IRemoteDiagnosticError, void>, index: number, templateData: IProcessRowTemplateData, height: number | undefined): void {
@@ -163,12 +162,12 @@ class ProcessRenderer implements ITreeRenderer<ProcessItem, void, IProcessItemTe
templateId: string = 'process';
renderTemplate(container: HTMLElement): IProcessItemTemplateData {
const data = <IProcessItemTemplateData>Object.create(null);
const row = dom.append(container, dom.$('.row'));
const row = append(container, $('.row'));
data.name = dom.append(row, dom.$('.nameLabel'));
data.CPU = dom.append(row, dom.$('.cpu'));
data.memory = dom.append(row, dom.$('.memory'));
data.PID = dom.append(row, dom.$('.pid'));
data.name = append(row, $('.nameLabel'));
data.CPU = append(row, $('.cpu'));
data.memory = append(row, $('.memory'));
data.PID = append(row, $('.pid'));
return data;
}
@@ -226,8 +225,6 @@ class ProcessExplorer {
private mapPidToWindowTitle = new Map<number, string>();
private listeners = new DisposableStore();
private nativeHostService: INativeHostService;
private tree: DataTree<any, ProcessTree | MachineProcessInformation | ProcessItem | ProcessInformation | IRemoteDiagnosticError, any> | undefined;
@@ -237,6 +234,7 @@ class ProcessExplorer {
this.nativeHostService = new NativeHostService(windowId, mainProcessService) as INativeHostService;
this.applyStyles(data.styles);
this.setEventHandlers(data);
// Map window process pids to titles, annotate process names with this when rendering to distinguish between them
ipcRenderer.on('vscode:windowsInfoResponse', (event: unknown, windows: any[]) => {
@@ -263,6 +261,32 @@ class ProcessExplorer {
this.lastRequestTime = Date.now();
ipcRenderer.send('vscode:windowsInfoRequest');
ipcRenderer.send('vscode:listProcesses');
}
private setEventHandlers(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();
ipcRenderer.send('vscode:closeProcessExplorer');
}
// Cmd/Ctrl + zooms in
if (cmdOrCtrlKey && e.keyCode === 187) {
zoomIn();
}
// Cmd/Ctrl - zooms out
if (cmdOrCtrlKey && e.keyCode === 189) {
zoomOut();
}
};
}
private async createProcessTree(processRoots: MachineProcessInformation[]): Promise<void> {
@@ -449,39 +473,12 @@ class ProcessExplorer {
}
}, 200);
}
public dispose() {
this.listeners.dispose();
}
}
export function startup(windowId: number, data: ProcessExplorerData): void {
const platformClass = data.platform === 'win32' ? 'windows' : data.platform === 'linux' ? 'linux' : 'mac';
export function startup(configuration: ProcessExplorerWindowConfiguration): void {
const platformClass = configuration.data.platform === 'win32' ? 'windows' : configuration.data.platform === 'linux' ? 'linux' : 'mac';
document.body.classList.add(platformClass); // used by our fonts
applyZoom(data.zoomLevel);
applyZoom(configuration.data.zoomLevel);
const processExplorer = new ProcessExplorer(windowId, data);
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();
}
// Cmd/Ctrl - zooms out
if (cmdOrCtrlKey && e.keyCode === 189) {
zoomOut();
}
};
new ProcessExplorer(configuration.windowId, configuration.data);
}

View File

@@ -3,7 +3,7 @@
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="Content-Security-Policy" content="default-src 'none'; img-src 'self' https: data: blob: vscode-remote-resource:; media-src 'none'; frame-src 'self' vscode-webview: https://*.vscode-webview-test.com; object-src 'self'; script-src 'self' 'unsafe-eval'; style-src 'self' 'unsafe-inline'; connect-src 'self' https: ws:; font-src 'self' https: vscode-remote-resource:;">
<meta http-equiv="Content-Security-Policy" content="default-src 'none'; img-src 'self' https: data: blob: vscode-remote-resource:; media-src 'none'; frame-src 'self' vscode-webview:; object-src 'self'; script-src 'self' 'unsafe-eval'; style-src 'self' 'unsafe-inline'; connect-src 'self' https: ws:; font-src 'self' https: vscode-remote-resource:;">
<meta http-equiv="Content-Security-Policy" content="require-trusted-types-for 'script'; trusted-types default TrustedFunctionWorkaround ExtensionScripts amdLoader cellRendererEditorText defaultWorkerFactory diffEditorWidget domLineBreaksComputer editorViewLayer diffReview extensionHostWorker insane notebookOutputRenderer safeInnerHtml standaloneColorizer tokenizeToString webNestedWorkerExtensionHost webWorkerExtensionHost;">
</head>
<body aria-label="">

View File

@@ -32,15 +32,38 @@
return require('vs/workbench/electron-sandbox/desktop.main').main(configuration);
},
{
removeDeveloperKeybindingsAfterLoad: true,
configureDeveloperSettings: function (windowConfig) {
return {
// disable automated devtools opening on error when running extension tests
// as this can lead to undeterministic test exectuion (devtools steals focus)
forceDisableShowDevtoolsOnError: typeof windowConfig.extensionTestsPath === 'string',
// enable devtools keybindings in extension development window
forceEnableDeveloperKeybindings: Array.isArray(windowConfig.extensionDevelopmentPath) && windowConfig.extensionDevelopmentPath.length > 0,
removeDeveloperKeybindingsAfterLoad: true
};
},
canModifyDOM: function (windowConfig) {
// TODO@sandbox part-splash is non-sandboxed only
},
beforeLoaderConfig: function (windowConfig, loaderConfig) {
beforeLoaderConfig: function (loaderConfig) {
loaderConfig.recordStats = true;
},
beforeRequire: function () {
performance.mark('code/willLoadWorkbenchMain');
// It looks like browsers only lazily enable
// the <canvas> element when needed. Since we
// leverage canvas elements in our code in many
// locations, we try to help the browser to
// initialize canvas when it is idle, right
// before we wait for the scripts to be loaded.
// @ts-ignore
window.requestIdleCallback(() => {
const canvas = document.createElement('canvas');
const context = canvas.getContext('2d');
context.clearRect(0, 0, canvas.width, canvas.height);
canvas.remove();
}, { timeout: 50 });
}
}
);
@@ -62,12 +85,26 @@
}
});
//region Helpers
//#region Helpers
/**
* @typedef {import('../../../platform/windows/common/windows').INativeWindowConfiguration} INativeWindowConfiguration
*
* @returns {{
* load: (modules: string[], resultCallback: (result, configuration: import('../../../platform/windows/common/windows').INativeWindowConfiguration) => any, options: object) => unknown,
* globals: () => typeof import('../../../base/parts/sandbox/electron-sandbox/globals')
* load: (
* modules: string[],
* resultCallback: (result, configuration: INativeWindowConfiguration) => unknown,
* options?: {
* configureDeveloperSettings?: (config: INativeWindowConfiguration & object) => {
* forceEnableDeveloperKeybindings?: boolean,
* disallowReloadKeybinding?: boolean,
* removeDeveloperKeybindingsAfterLoad?: boolean
* },
* canModifyDOM?: (config: INativeWindowConfiguration & object) => void,
* beforeLoaderConfig?: (loaderConfig: object) => void,
* beforeRequire?: () => void
* }
* ) => Promise<unknown>
* }}
*/
function bootstrapWindowLib() {