mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
Merge from vscode 2c306f762bf9c3db82dc06c7afaa56ef46d72f79 (#14050)
* Merge from vscode 2c306f762bf9c3db82dc06c7afaa56ef46d72f79 * Fix breaks * Extension management fixes * Fix breaks in windows bundling * Fix/skip failing tests * Update distro * Add clear to nuget.config * Add hygiene task * Bump distro * Fix hygiene issue * Add build to hygiene exclusion * Update distro * Update hygiene * Hygiene exclusions * Update tsconfig * Bump distro for server breaks * Update build config * Update darwin path * Add done calls to notebook tests * Skip failing tests * Disable smoke tests
This commit is contained in:
@@ -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
|
||||
}());
|
||||
|
||||
@@ -5,10 +5,11 @@
|
||||
|
||||
import 'vs/css!./media/issueReporter';
|
||||
import 'vs/base/browser/ui/codicons/codiconStyles'; // make sure codicon css is loaded
|
||||
import { ElectronService, IElectronService } from 'vs/platform/electron/electron-sandbox/electron';
|
||||
import { INativeHostService } from 'vs/platform/native/electron-sandbox/native';
|
||||
import { NativeHostService } from 'vs/platform/native/electron-sandbox/nativeHostService';
|
||||
import { ipcRenderer, process } from 'vs/base/parts/sandbox/electron-sandbox/globals';
|
||||
import { applyZoom, zoomIn, zoomOut } from 'vs/platform/windows/electron-sandbox/window';
|
||||
import { $, reset, windowOpenNoOpener, addClass } from 'vs/base/browser/dom';
|
||||
import { $, reset, safeInnerHtml, windowOpenNoOpener } from 'vs/base/browser/dom';
|
||||
import { Button } from 'vs/base/browser/ui/button/button';
|
||||
import { CodiconLabel } from 'vs/base/browser/ui/codicons/codiconLabel';
|
||||
import * as collections from 'vs/base/common/collections';
|
||||
@@ -55,9 +56,10 @@ export interface IssueReporterConfiguration extends IWindowConfiguration {
|
||||
|
||||
export function startup(configuration: IssueReporterConfiguration) {
|
||||
const platformClass = platform.isWindows ? 'windows' : platform.isLinux ? 'linux' : 'mac';
|
||||
addClass(document.body, platformClass); // used by our fonts
|
||||
document.body.classList.add(platformClass); // used by our fonts
|
||||
|
||||
safeInnerHtml(document.body, BaseHtml());
|
||||
|
||||
document.body.innerHTML = BaseHtml();
|
||||
const issueReporter = new IssueReporter(configuration);
|
||||
issueReporter.render();
|
||||
document.body.style.display = 'block';
|
||||
@@ -65,7 +67,7 @@ export function startup(configuration: IssueReporterConfiguration) {
|
||||
}
|
||||
|
||||
export class IssueReporter extends Disposable {
|
||||
private electronService!: IElectronService;
|
||||
private nativeHostService!: INativeHostService;
|
||||
private readonly issueReporterModel: IssueReporterModel;
|
||||
private numberOfSearchResultsDisplayed = 0;
|
||||
private receivedSystemInfo = false;
|
||||
@@ -148,6 +150,7 @@ export class IssueReporter extends Disposable {
|
||||
applyZoom(configuration.data.zoomLevel);
|
||||
this.applyStyles(configuration.data.styles);
|
||||
this.handleExtensionData(configuration.data.enabledExtensions);
|
||||
this.updateExperimentsInfo(configuration.data.experiments);
|
||||
}
|
||||
|
||||
render(): void {
|
||||
@@ -267,8 +270,8 @@ export class IssueReporter extends Disposable {
|
||||
const mainProcessService = new MainProcessService(configuration.windowId);
|
||||
serviceCollection.set(IMainProcessService, mainProcessService);
|
||||
|
||||
this.electronService = new ElectronService(configuration.windowId, mainProcessService) as IElectronService;
|
||||
serviceCollection.set(IElectronService, this.electronService);
|
||||
this.nativeHostService = new NativeHostService(configuration.windowId, mainProcessService) as INativeHostService;
|
||||
serviceCollection.set(INativeHostService, this.nativeHostService);
|
||||
}
|
||||
|
||||
private setEventHandlers(): void {
|
||||
@@ -283,7 +286,7 @@ export class IssueReporter extends Disposable {
|
||||
this.render();
|
||||
});
|
||||
|
||||
(['includeSystemInfo', 'includeProcessInfo', 'includeWorkspaceInfo', 'includeExtensions', 'includeSearchedExtensions', 'includeSettingsSearchDetails'] as const).forEach(elementId => {
|
||||
(['includeSystemInfo', 'includeProcessInfo', 'includeWorkspaceInfo', 'includeExtensions', 'includeExperiments'] as const).forEach(elementId => {
|
||||
this.addEventListener(elementId, 'click', (event: Event) => {
|
||||
event.stopPropagation();
|
||||
this.issueReporterModel.update({ [elementId]: !this.issueReporterModel.getData()[elementId] });
|
||||
@@ -691,8 +694,7 @@ export class IssueReporter extends Disposable {
|
||||
const processBlock = document.querySelector('.block-process');
|
||||
const workspaceBlock = document.querySelector('.block-workspace');
|
||||
const extensionsBlock = document.querySelector('.block-extensions');
|
||||
const searchedExtensionsBlock = document.querySelector('.block-searchedExtensions');
|
||||
const settingsSearchResultsBlock = document.querySelector('.block-settingsSearchResults');
|
||||
const experimentsBlock = document.querySelector('.block-experiments');
|
||||
|
||||
const problemSource = this.getElementById('problem-source')!;
|
||||
const descriptionTitle = this.getElementById('issue-description-label')!;
|
||||
@@ -705,8 +707,7 @@ export class IssueReporter extends Disposable {
|
||||
hide(processBlock);
|
||||
hide(workspaceBlock);
|
||||
hide(extensionsBlock);
|
||||
hide(searchedExtensionsBlock);
|
||||
hide(settingsSearchResultsBlock);
|
||||
hide(experimentsBlock);
|
||||
hide(problemSource);
|
||||
hide(extensionSelector);
|
||||
|
||||
@@ -714,6 +715,7 @@ export class IssueReporter extends Disposable {
|
||||
show(blockContainer);
|
||||
show(systemBlock);
|
||||
show(problemSource);
|
||||
show(experimentsBlock);
|
||||
|
||||
if (fileOnExtension) {
|
||||
show(extensionSelector);
|
||||
@@ -728,6 +730,7 @@ export class IssueReporter extends Disposable {
|
||||
show(processBlock);
|
||||
show(workspaceBlock);
|
||||
show(problemSource);
|
||||
show(experimentsBlock);
|
||||
|
||||
if (fileOnExtension) {
|
||||
show(extensionSelector);
|
||||
@@ -827,7 +830,7 @@ export class IssueReporter extends Disposable {
|
||||
return new Promise((resolve, reject) => {
|
||||
ipcRenderer.once('vscode:issueReporterClipboardResponse', async (event: unknown, shouldWrite: boolean) => {
|
||||
if (shouldWrite) {
|
||||
await this.electronService.writeClipboardText(issueBody);
|
||||
await this.nativeHostService.writeClipboardText(issueBody);
|
||||
resolve(baseUrl + `&body=${encodeURIComponent(localize('pasteData', "We have written the needed data into your clipboard because it was too large to send. Please paste."))}`);
|
||||
} else {
|
||||
reject();
|
||||
@@ -1082,6 +1085,14 @@ export class IssueReporter extends Disposable {
|
||||
}
|
||||
}
|
||||
|
||||
private updateExperimentsInfo(experimentInfo: string | undefined) {
|
||||
this.issueReporterModel.update({ experimentInfo });
|
||||
const target = document.querySelector<HTMLElement>('.block-experiments .block-info');
|
||||
if (target) {
|
||||
target.textContent = experimentInfo ? experimentInfo : localize('noCurrentExperiments', "No current experiments.");
|
||||
}
|
||||
}
|
||||
|
||||
private getExtensionTableHtml(extensions: IssueReporterExtensionData[]): HTMLTableElement {
|
||||
return $('table', undefined,
|
||||
$('tr', undefined,
|
||||
|
||||
@@ -19,8 +19,7 @@ export interface IssueReporterData {
|
||||
includeWorkspaceInfo: boolean;
|
||||
includeProcessInfo: boolean;
|
||||
includeExtensions: boolean;
|
||||
includeSearchedExtensions: boolean;
|
||||
includeSettingsSearchDetails: boolean;
|
||||
includeExperiments: boolean;
|
||||
|
||||
numberOfThemeExtesions?: number;
|
||||
allExtensions: IssueReporterExtensionData[];
|
||||
@@ -31,6 +30,7 @@ export interface IssueReporterData {
|
||||
actualSearchResults?: ISettingSearchResult[];
|
||||
query?: string;
|
||||
filterResultCount?: number;
|
||||
experimentInfo?: string;
|
||||
}
|
||||
|
||||
export class IssueReporterModel {
|
||||
@@ -43,8 +43,7 @@ export class IssueReporterModel {
|
||||
includeWorkspaceInfo: true,
|
||||
includeProcessInfo: true,
|
||||
includeExtensions: true,
|
||||
includeSearchedExtensions: true,
|
||||
includeSettingsSearchDetails: true,
|
||||
includeExperiments: true,
|
||||
allExtensions: []
|
||||
};
|
||||
|
||||
@@ -134,6 +133,12 @@ ${this.getInfos()}
|
||||
}
|
||||
}
|
||||
|
||||
if (this._data.issueType === IssueType.Bug || this._data.issueType === IssueType.PerformanceIssue) {
|
||||
if (this._data.includeExperiments && this._data.experimentInfo) {
|
||||
info += this.generateExperimentsInfoMd();
|
||||
}
|
||||
}
|
||||
|
||||
return info;
|
||||
}
|
||||
|
||||
@@ -151,7 +156,7 @@ ${this.getInfos()}
|
||||
|GPU Status|${Object.keys(this._data.systemInfo.gpuStatus).map(key => `${key}: ${this._data.systemInfo!.gpuStatus[key]}`).join('<br>')}|
|
||||
|Load (avg)|${this._data.systemInfo.load}|
|
||||
|Memory (System)|${this._data.systemInfo.memory}|
|
||||
|Process Argv|${this._data.systemInfo.processArgs}|
|
||||
|Process Argv|${this._data.systemInfo.processArgs.replace(/\\/g, '\\\\')}|
|
||||
|Screen Reader|${this._data.systemInfo.screenReader}|
|
||||
|VM|${this._data.systemInfo.vmHint}|`;
|
||||
|
||||
@@ -204,6 +209,18 @@ ${this._data.processInfo}
|
||||
${this._data.workspaceInfo};
|
||||
\`\`\`
|
||||
|
||||
</details>
|
||||
`;
|
||||
}
|
||||
|
||||
private generateExperimentsInfoMd(): string {
|
||||
return `<details>
|
||||
<summary>A/B Experiments</summary>
|
||||
|
||||
\`\`\`
|
||||
${this._data.experimentInfo}
|
||||
\`\`\`
|
||||
|
||||
</details>
|
||||
`;
|
||||
}
|
||||
|
||||
@@ -111,25 +111,15 @@ export default (): string => `
|
||||
<!-- To be dynamically filled -->
|
||||
</div>
|
||||
</div>
|
||||
<div class="block block-searchedExtensions">
|
||||
<input class="sendData" type="checkbox" id="includeSearchedExtensions" checked/>
|
||||
<label class="caption" for="includeSearchedExtensions">${escape(localize({
|
||||
key: 'sendSearchedExtensions',
|
||||
comment: ['{0} is either "show" or "hide" and is a button to toggle the visibility of the searched extensions']
|
||||
}, "Send searched extensions ({0})")).replace('{0}', `<a href="#" class="showInfo">${escape(localize('show', "show"))}</a>`)}</label>
|
||||
<div class="block-info hidden">
|
||||
<div class="block block-experiments">
|
||||
<input class="sendData" type="checkbox" id="includeExperiments" checked/>
|
||||
<label class="caption" for="includeExperiments">${escape(localize({
|
||||
key: 'sendExperiments',
|
||||
comment: ['{0} is either "show" or "hide" and is a button to toggle the visibility of the current experiment information']
|
||||
}, "Include A/B experiment info ({0})")).replace('{0}', `<a href="#" class="showInfo">${escape(localize('show', "show"))}</a>`)}</label>
|
||||
<pre class="block-info hidden">
|
||||
<!-- To be dynamically filled -->
|
||||
</div>
|
||||
</div>
|
||||
<div class="block block-settingsSearchResults">
|
||||
<input class="sendData" type="checkbox" id="includeSettingsSearchDetails" checked/>
|
||||
<label class="caption" for="includeSettingsSearchDetails">${escape(localize({
|
||||
key: 'sendSettingsSearchDetails',
|
||||
comment: ['{0} is either "show" or "hide" and is a button to toggle the visibility of the search details']
|
||||
}, "Send settings search details ({0})")).replace('{0}', `<a href="#" class="showInfo">${escape(localize('show', "show"))}</a>`)}</label>
|
||||
<div class="block-info hidden">
|
||||
<!-- To be dynamically filled -->
|
||||
</div>
|
||||
</pre>
|
||||
</div>
|
||||
</div>
|
||||
</div>`;
|
||||
|
||||
@@ -18,8 +18,7 @@ suite('IssueReporter', () => {
|
||||
includeWorkspaceInfo: true,
|
||||
includeProcessInfo: true,
|
||||
includeExtensions: true,
|
||||
includeSearchedExtensions: true,
|
||||
includeSettingsSearchDetails: true,
|
||||
includeExperiments: true,
|
||||
issueType: 0
|
||||
});
|
||||
});
|
||||
@@ -191,6 +190,45 @@ Remote OS version: Linux x64 4.18.0
|
||||
<!-- generated by issue reporter -->`);
|
||||
});
|
||||
|
||||
test.skip('escapes backslashes in processArgs', () => {
|
||||
const issueReporterModel = new IssueReporterModel({
|
||||
issueType: 0,
|
||||
systemInfo: {
|
||||
os: 'Darwin',
|
||||
cpus: 'Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz (8 x 2800)',
|
||||
memory: '16.00GB',
|
||||
vmHint: '0%',
|
||||
processArgs: '\\\\HOST\\path',
|
||||
screenReader: 'no',
|
||||
remoteData: [],
|
||||
gpuStatus: {}
|
||||
}
|
||||
});
|
||||
assert.equal(issueReporterModel.serialize(),
|
||||
`
|
||||
Issue Type: <b>Bug</b>
|
||||
|
||||
undefined
|
||||
|
||||
VS Code version: undefined
|
||||
OS version: undefined
|
||||
|
||||
<details>
|
||||
<summary>System Info</summary>
|
||||
|
||||
|Item|Value|
|
||||
|---|---|
|
||||
|CPUs|Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz (8 x 2800)|
|
||||
|GPU Status||
|
||||
|Load (avg)|undefined|
|
||||
|Memory (System)|16.00GB|
|
||||
|Process Argv|\\\\\\\\HOST\\\\path|
|
||||
|Screen Reader|no|
|
||||
|VM|0%|
|
||||
</details>Extensions: none
|
||||
<!-- generated by issue reporter -->`);
|
||||
});
|
||||
|
||||
test('should normalize GitHub urls', () => {
|
||||
[
|
||||
'https://github.com/repo',
|
||||
|
||||
@@ -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
|
||||
}());
|
||||
|
||||
@@ -5,7 +5,8 @@
|
||||
|
||||
import 'vs/css!./media/processExplorer';
|
||||
import 'vs/base/browser/ui/codicons/codiconStyles'; // make sure codicon css is loaded
|
||||
import { ElectronService, IElectronService } from 'vs/platform/electron/electron-sandbox/electron';
|
||||
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';
|
||||
@@ -13,11 +14,12 @@ import { applyZoom, zoomIn, zoomOut } from 'vs/platform/windows/electron-sandbox
|
||||
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 { addDisposableListener, addClass, $ } from 'vs/base/browser/dom';
|
||||
import { addDisposableListener, $ } from 'vs/base/browser/dom';
|
||||
import { DisposableStore } from 'vs/base/common/lifecycle';
|
||||
import { isRemoteDiagnosticError, IRemoteDiagnosticError } from 'vs/platform/diagnostics/common/diagnostics';
|
||||
import { MainProcessService } from 'vs/platform/ipc/electron-sandbox/mainProcessService';
|
||||
import { CodiconLabel } from 'vs/base/browser/ui/codicons/codiconLabel';
|
||||
import { ByteSize } from 'vs/platform/files/common/files';
|
||||
|
||||
const DEBUG_FLAGS_PATTERN = /\s--(inspect|debug)(-brk|port)?=(\d+)?/;
|
||||
const DEBUG_PORT_PATTERN = /\s--(inspect|debug)-port=(\d+)/;
|
||||
@@ -40,11 +42,11 @@ class ProcessExplorer {
|
||||
|
||||
private listeners = new DisposableStore();
|
||||
|
||||
private electronService: IElectronService;
|
||||
private nativeHostService: INativeHostService;
|
||||
|
||||
constructor(windowId: number, private data: ProcessExplorerData) {
|
||||
const mainProcessService = new MainProcessService(windowId);
|
||||
this.electronService = new ElectronService(windowId, mainProcessService) as IElectronService;
|
||||
this.nativeHostService = new NativeHostService(windowId, mainProcessService) as INativeHostService;
|
||||
|
||||
this.applyStyles(data.styles);
|
||||
|
||||
@@ -66,18 +68,19 @@ class ProcessExplorer {
|
||||
|
||||
private getProcessList(rootProcess: ProcessItem, isLocal: boolean, totalMem: number): FormattedProcessItem[] {
|
||||
const processes: FormattedProcessItem[] = [];
|
||||
const handledProcesses = new Set<number>();
|
||||
|
||||
if (rootProcess) {
|
||||
this.getProcessItem(processes, rootProcess, 0, isLocal, totalMem);
|
||||
this.getProcessItem(processes, rootProcess, 0, isLocal, totalMem, handledProcesses);
|
||||
}
|
||||
|
||||
return processes;
|
||||
}
|
||||
|
||||
private getProcessItem(processes: FormattedProcessItem[], item: ProcessItem, indent: number, isLocal: boolean, totalMem: number): void {
|
||||
private getProcessItem(processes: FormattedProcessItem[], item: ProcessItem, indent: number, isLocal: boolean, totalMem: number, handledProcesses: Set<number>): void {
|
||||
const isRoot = (indent === 0);
|
||||
|
||||
const MB = 1024 * 1024;
|
||||
handledProcesses.add(item.pid);
|
||||
|
||||
let name = item.name;
|
||||
if (isRoot) {
|
||||
@@ -94,7 +97,7 @@ class ProcessExplorer {
|
||||
const memory = this.data.platform === 'win32' ? item.mem : (totalMem * (item.mem / 100));
|
||||
processes.push({
|
||||
cpu: item.load,
|
||||
memory: (memory / MB),
|
||||
memory: (memory / ByteSize.MB),
|
||||
pid: item.pid.toFixed(0),
|
||||
name,
|
||||
formattedName,
|
||||
@@ -104,9 +107,11 @@ class ProcessExplorer {
|
||||
// Recurse into children if any
|
||||
if (Array.isArray(item.children)) {
|
||||
item.children.forEach(child => {
|
||||
if (child) {
|
||||
this.getProcessItem(processes, child, indent + 1, isLocal, totalMem);
|
||||
if (!child || handledProcesses.has(child.pid)) {
|
||||
return; // prevent loops
|
||||
}
|
||||
|
||||
this.getProcessItem(processes, child, indent + 1, isLocal, totalMem, handledProcesses);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -293,13 +298,13 @@ class ProcessExplorer {
|
||||
container.append(tableHead);
|
||||
|
||||
const hasMultipleMachines = Object.keys(processLists).length > 1;
|
||||
const totalMem = await this.electronService.getTotalMem();
|
||||
const { totalmem } = await this.nativeHostService.getOSStatistics();
|
||||
processLists.forEach((remote, i) => {
|
||||
const isLocal = i === 0;
|
||||
if (isRemoteDiagnosticError(remote.rootProcess)) {
|
||||
this.renderProcessFetchError(remote.name, remote.rootProcess.errorMessage);
|
||||
} else {
|
||||
this.renderTableSection(remote.name, this.getProcessList(remote.rootProcess, isLocal, totalMem), hasMultipleMachines, isLocal);
|
||||
this.renderTableSection(remote.name, this.getProcessList(remote.rootProcess, isLocal, totalmem), hasMultipleMachines, isLocal);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -320,7 +325,7 @@ class ProcessExplorer {
|
||||
content.push(`.highest { color: ${styles.highlightForeground}; }`);
|
||||
}
|
||||
|
||||
styleTag.innerHTML = content.join('\n');
|
||||
styleTag.textContent = content.join('\n');
|
||||
if (document.head) {
|
||||
document.head.appendChild(styleTag);
|
||||
}
|
||||
@@ -339,14 +344,14 @@ class ProcessExplorer {
|
||||
items.push({
|
||||
label: localize('killProcess', "Kill Process"),
|
||||
click: () => {
|
||||
this.electronService.killProcess(pid, 'SIGTERM');
|
||||
this.nativeHostService.killProcess(pid, 'SIGTERM');
|
||||
}
|
||||
});
|
||||
|
||||
items.push({
|
||||
label: localize('forceKillProcess', "Force Kill Process"),
|
||||
click: () => {
|
||||
this.electronService.killProcess(pid, 'SIGKILL');
|
||||
this.nativeHostService.killProcess(pid, 'SIGKILL');
|
||||
}
|
||||
});
|
||||
|
||||
@@ -360,7 +365,7 @@ class ProcessExplorer {
|
||||
click: () => {
|
||||
const row = document.getElementById(pid.toString());
|
||||
if (row) {
|
||||
this.electronService.writeClipboardText(row.innerText);
|
||||
this.nativeHostService.writeClipboardText(row.innerText);
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -370,7 +375,7 @@ class ProcessExplorer {
|
||||
click: () => {
|
||||
const processList = document.getElementById('process-list');
|
||||
if (processList) {
|
||||
this.electronService.writeClipboardText(processList.innerText);
|
||||
this.nativeHostService.writeClipboardText(processList.innerText);
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -416,7 +421,7 @@ class ProcessExplorer {
|
||||
|
||||
export function startup(windowId: number, data: ProcessExplorerData): void {
|
||||
const platformClass = data.platform === 'win32' ? 'windows' : data.platform === 'linux' ? 'linux' : 'mac';
|
||||
addClass(document.body, platformClass); // used by our fonts
|
||||
document.body.classList.add(platformClass); // used by our fonts
|
||||
applyZoom(data.zoomLevel);
|
||||
|
||||
const processExplorer = new ProcessExplorer(windowId, data);
|
||||
@@ -424,6 +429,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();
|
||||
@@ -434,13 +448,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');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -8,67 +8,59 @@
|
||||
//@ts-check
|
||||
'use strict';
|
||||
|
||||
const perf = (function () {
|
||||
globalThis.MonacoPerformanceMarks = globalThis.MonacoPerformanceMarks || [];
|
||||
return {
|
||||
/**
|
||||
* @param {string} name
|
||||
*/
|
||||
mark(name) {
|
||||
globalThis.MonacoPerformanceMarks.push(name, Date.now());
|
||||
}
|
||||
};
|
||||
})();
|
||||
(function () {
|
||||
const bootstrapWindow = bootstrapWindowLib();
|
||||
|
||||
perf.mark('renderer/started');
|
||||
// Add a perf entry right from the top
|
||||
const perf = bootstrapWindow.perfLib();
|
||||
perf.mark('renderer/started');
|
||||
|
||||
/**
|
||||
* @type {{
|
||||
* load: (modules: string[], resultCallback: (result, configuration: object) => any, options: object) => unknown,
|
||||
* globals: () => typeof import('../../../base/parts/sandbox/electron-sandbox/globals')
|
||||
* }}
|
||||
*/
|
||||
const bootstrapWindow = (() => {
|
||||
// @ts-ignore (defined in bootstrap-window.js)
|
||||
return window.MonacoBootstrapWindow;
|
||||
})();
|
||||
// Load workbench main JS, CSS and NLS all in parallel. This is an
|
||||
// optimization to prevent a waterfall of loading to happen, because
|
||||
// we know for a fact that workbench.desktop.sandbox.main will depend on
|
||||
// the related CSS and NLS counterparts.
|
||||
bootstrapWindow.load([
|
||||
'vs/workbench/workbench.desktop.sandbox.main',
|
||||
'vs/nls!vs/workbench/workbench.desktop.main',
|
||||
'vs/css!vs/workbench/workbench.desktop.main'
|
||||
],
|
||||
async function (workbench, configuration) {
|
||||
|
||||
// Load environment in parallel to workbench loading to avoid waterfall
|
||||
const whenEnvResolved = bootstrapWindow.globals().process.whenEnvResolved;
|
||||
// Mark start of workbench
|
||||
perf.mark('didLoadWorkbenchMain');
|
||||
|
||||
// Load workbench main JS, CSS and NLS all in parallel. This is an
|
||||
// optimization to prevent a waterfall of loading to happen, because
|
||||
// we know for a fact that workbench.desktop.sandbox.main will depend on
|
||||
// the related CSS and NLS counterparts.
|
||||
bootstrapWindow.load([
|
||||
'vs/workbench/workbench.desktop.sandbox.main',
|
||||
'vs/nls!vs/workbench/workbench.desktop.main',
|
||||
'vs/css!vs/workbench/workbench.desktop.main'
|
||||
],
|
||||
async function (workbench, configuration) {
|
||||
|
||||
// Mark start of workbench
|
||||
perf.mark('didLoadWorkbenchMain');
|
||||
performance.mark('workbench-start');
|
||||
|
||||
// Wait for process environment being fully resolved
|
||||
await whenEnvResolved;
|
||||
|
||||
perf.mark('main/startup');
|
||||
|
||||
// @ts-ignore
|
||||
return require('vs/workbench/electron-sandbox/desktop.main').main(configuration);
|
||||
},
|
||||
{
|
||||
removeDeveloperKeybindingsAfterLoad: true,
|
||||
canModifyDOM: function (windowConfig) {
|
||||
// TODO@sandbox part-splash is non-sandboxed only
|
||||
// @ts-ignore
|
||||
return require('vs/workbench/electron-sandbox/desktop.main').main(configuration);
|
||||
},
|
||||
beforeLoaderConfig: function (windowConfig, loaderConfig) {
|
||||
loaderConfig.recordStats = true;
|
||||
},
|
||||
beforeRequire: function () {
|
||||
perf.mark('willLoadWorkbenchMain');
|
||||
{
|
||||
removeDeveloperKeybindingsAfterLoad: true,
|
||||
canModifyDOM: function (windowConfig) {
|
||||
// TODO@sandbox part-splash is non-sandboxed only
|
||||
},
|
||||
beforeLoaderConfig: function (windowConfig, loaderConfig) {
|
||||
loaderConfig.recordStats = true;
|
||||
},
|
||||
beforeRequire: function () {
|
||||
perf.mark('willLoadWorkbenchMain');
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
//region Helpers
|
||||
|
||||
/**
|
||||
* @returns {{
|
||||
* load: (modules: string[], resultCallback: (result, configuration: object) => any, options: object) => unknown,
|
||||
* globals: () => typeof import('../../../base/parts/sandbox/electron-sandbox/globals'),
|
||||
* perfLib: () => { mark: (name: string) => void }
|
||||
* }}
|
||||
*/
|
||||
function bootstrapWindowLib() {
|
||||
// @ts-ignore (defined in bootstrap-window.js)
|
||||
return window.MonacoBootstrapWindow;
|
||||
}
|
||||
);
|
||||
|
||||
//#endregion
|
||||
|
||||
}());
|
||||
|
||||
Reference in New Issue
Block a user