Merge from vscode 1eb87b0e9ce9886afeaecec22b31abd0d9b7939f (#7282)

* Merge from vscode 1eb87b0e9ce9886afeaecec22b31abd0d9b7939f

* fix various icon issues

* fix preview features
This commit is contained in:
Anthony Dresser
2019-09-19 21:50:52 -07:00
committed by GitHub
parent 9d3d64eef3
commit db498db0a8
459 changed files with 10195 additions and 7528 deletions

View File

@@ -3,29 +3,15 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { IChannel } from 'vs/base/parts/ipc/common/ipc';
import { IIssueService, IssueReporterData, ProcessExplorerData } from 'vs/platform/issue/node/issue';
import { IIssueService } from 'vs/platform/issue/node/issue';
import { IMainProcessService } from 'vs/platform/ipc/electron-browser/mainProcessService';
import { createSimpleChannelProxy } from 'vs/platform/ipc/node/simpleIpcProxy';
export class IssueService implements IIssueService {
export class IssueService {
_serviceBrand: undefined;
private channel: IChannel;
constructor(@IMainProcessService mainProcessService: IMainProcessService) {
this.channel = mainProcessService.getChannel('issue');
}
openReporter(data: IssueReporterData): Promise<void> {
return this.channel.call('openIssueReporter', data);
}
openProcessExplorer(data: ProcessExplorerData): Promise<void> {
return this.channel.call('openProcessExplorer', data);
}
getSystemStatus(): Promise<string> {
return this.channel.call('getSystemStatus');
return createSimpleChannelProxy<IIssueService>(mainProcessService.getChannel('issue'));
}
}

View File

@@ -7,8 +7,8 @@ import { localize } from 'vs/nls';
import * as objects from 'vs/base/common/objects';
import { parseArgs, OPTIONS } from 'vs/platform/environment/node/argv';
import { IIssueService, IssueReporterData, IssueReporterFeatures, ProcessExplorerData } from 'vs/platform/issue/node/issue';
import { BrowserWindow, ipcMain, screen, Event, dialog } from 'electron';
import { ILaunchService } from 'vs/platform/launch/electron-main/launchService';
import { BrowserWindow, ipcMain, screen, dialog } from 'electron';
import { ILaunchMainService } from 'vs/platform/launch/electron-main/launchService';
import { PerformanceInfo, isRemoteDiagnosticError } from 'vs/platform/diagnostics/common/diagnostics';
import { IDiagnosticsService } from 'vs/platform/diagnostics/node/diagnosticsService';
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
@@ -20,7 +20,7 @@ import { listProcesses } from 'vs/base/node/ps';
const DEFAULT_BACKGROUND_COLOR = '#1E1E1E';
export class IssueService implements IIssueService {
export class IssueMainService implements IIssueService {
_serviceBrand: undefined;
_issueWindow: BrowserWindow | null = null;
_issueParentWindow: BrowserWindow | null = null;
@@ -31,7 +31,7 @@ export class IssueService implements IIssueService {
private machineId: string,
private userEnv: IProcessEnvironment,
@IEnvironmentService private readonly environmentService: IEnvironmentService,
@ILaunchService private readonly launchService: ILaunchService,
@ILaunchMainService private readonly launchMainService: ILaunchMainService,
@ILogService private readonly logService: ILogService,
@IDiagnosticsService private readonly diagnosticsService: IDiagnosticsService,
@IWindowsService private readonly windowsService: IWindowsService
@@ -40,8 +40,8 @@ export class IssueService implements IIssueService {
}
private registerListeners(): void {
ipcMain.on('vscode:issueSystemInfoRequest', async (event: Event) => {
Promise.all([this.launchService.getMainProcessInfo(), this.launchService.getRemoteDiagnostics({ includeProcesses: false, includeWorkspaceMetadata: false })])
ipcMain.on('vscode:issueSystemInfoRequest', async (event: Electron.IpcMainEvent) => {
Promise.all([this.launchMainService.getMainProcessInfo(), this.launchMainService.getRemoteDiagnostics({ includeProcesses: false, includeWorkspaceMetadata: false })])
.then(result => {
const [info, remoteData] = result;
this.diagnosticsService.getSystemInfo(info, remoteData).then(msg => {
@@ -50,13 +50,13 @@ export class IssueService implements IIssueService {
});
});
ipcMain.on('vscode:listProcesses', async (event: Event) => {
ipcMain.on('vscode:listProcesses', async (event: Electron.IpcMainEvent) => {
const processes = [];
try {
const mainPid = await this.launchService.getMainProcessId();
const mainPid = await this.launchMainService.getMainProcessId();
processes.push({ name: localize('local', "Local"), rootProcess: await listProcesses(mainPid) });
(await this.launchService.getRemoteDiagnostics({ includeProcesses: true }))
(await this.launchMainService.getRemoteDiagnostics({ includeProcesses: true }))
.forEach(data => {
if (isRemoteDiagnosticError(data)) {
processes.push({
@@ -79,7 +79,7 @@ export class IssueService implements IIssueService {
event.sender.send('vscode:listProcessesResponse', processes);
});
ipcMain.on('vscode:issueReporterClipboard', (event: Event) => {
ipcMain.on('vscode:issueReporterClipboard', (event: Electron.IpcMainEvent) => {
const messageOptions = {
message: localize('issueReporterWriteToClipboard', "There is too much data to send to GitHub. Would you like to write the information to the clipboard so that it can be pasted?"),
type: 'warning',
@@ -90,13 +90,14 @@ export class IssueService implements IIssueService {
};
if (this._issueWindow) {
dialog.showMessageBox(this._issueWindow, messageOptions, response => {
event.sender.send('vscode:issueReporterClipboardResponse', response === 0);
});
dialog.showMessageBox(this._issueWindow, messageOptions)
.then(result => {
event.sender.send('vscode:issueReporterClipboardResponse', result.response === 0);
});
}
});
ipcMain.on('vscode:issuePerformanceInfoRequest', (event: Event) => {
ipcMain.on('vscode:issuePerformanceInfoRequest', (event: Electron.IpcMainEvent) => {
this.getPerformanceInfo().then(msg => {
event.sender.send('vscode:issuePerformanceInfoResponse', msg);
});
@@ -113,14 +114,15 @@ export class IssueService implements IIssueService {
};
if (this._issueWindow) {
dialog.showMessageBox(this._issueWindow, messageOptions, (response) => {
if (response === 0) {
if (this._issueWindow) {
this._issueWindow.destroy();
this._issueWindow = null;
dialog.showMessageBox(this._issueWindow, messageOptions)
.then(result => {
if (result.response === 0) {
if (this._issueWindow) {
this._issueWindow.destroy();
this._issueWindow = null;
}
}
}
});
});
}
});
@@ -148,14 +150,14 @@ export class IssueService implements IIssueService {
this.windowsService.openExternal(arg);
});
ipcMain.on('vscode:closeIssueReporter', (event: Event) => {
ipcMain.on('vscode:closeIssueReporter', (event: Electron.IpcMainEvent) => {
if (this._issueWindow) {
this._issueWindow.close();
}
});
ipcMain.on('windowsInfoRequest', (event: Event) => {
this.launchService.getMainProcessInfo().then(info => {
ipcMain.on('windowsInfoRequest', (event: Electron.IpcMainEvent) => {
this.launchMainService.getMainProcessInfo().then(info => {
event.sender.send('vscode:windowsInfoResponse', info.windows);
});
});
@@ -178,7 +180,10 @@ export class IssueService implements IIssueService {
x: position.x,
y: position.y,
title: localize('issueReporter', "Issue Reporter"),
backgroundColor: data.styles.backgroundColor || DEFAULT_BACKGROUND_COLOR
backgroundColor: data.styles.backgroundColor || DEFAULT_BACKGROUND_COLOR,
webPreferences: {
nodeIntegration: true
}
});
this._issueWindow.setMenuBarVisibility(false); // workaround for now, until a menu is implemented
@@ -224,7 +229,10 @@ export class IssueService implements IIssueService {
x: position.x,
y: position.y,
backgroundColor: data.styles.backgroundColor,
title: localize('processExplorer', "Process Explorer")
title: localize('processExplorer', "Process Explorer"),
webPreferences: {
nodeIntegration: true
}
});
this._processExplorerWindow.setMenuBarVisibility(false);
@@ -260,7 +268,7 @@ export class IssueService implements IIssueService {
}
public async getSystemStatus(): Promise<string> {
return Promise.all([this.launchService.getMainProcessInfo(), this.launchService.getRemoteDiagnostics({ includeProcesses: false, includeWorkspaceMetadata: false })])
return Promise.all([this.launchMainService.getMainProcessInfo(), this.launchMainService.getRemoteDiagnostics({ includeProcesses: false, includeWorkspaceMetadata: false })])
.then(result => {
const [info, remoteData] = result;
return this.diagnosticsService.getDiagnostics(info, remoteData);
@@ -337,7 +345,7 @@ export class IssueService implements IIssueService {
private getPerformanceInfo(): Promise<PerformanceInfo> {
return new Promise(async (resolve, reject) => {
Promise.all([this.launchService.getMainProcessInfo(), this.launchService.getRemoteDiagnostics({ includeProcesses: true, includeWorkspaceMetadata: true })])
Promise.all([this.launchMainService.getMainProcessInfo(), this.launchMainService.getRemoteDiagnostics({ includeProcesses: true, includeWorkspaceMetadata: true })])
.then(result => {
const [info, remoteData] = result;
this.diagnosticsService.getPerformanceInfo(info, remoteData)

View File

@@ -1,30 +0,0 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { IServerChannel } from 'vs/base/parts/ipc/common/ipc';
import { Event } from 'vs/base/common/event';
import { IIssueService } from 'vs/platform/issue/node/issue';
export class IssueChannel implements IServerChannel {
constructor(private service: IIssueService) { }
listen<T>(_: unknown, event: string): Event<T> {
throw new Error(`Event not found: ${event}`);
}
call(_: unknown, command: string, arg?: any): Promise<any> {
switch (command) {
case 'openIssueReporter':
return this.service.openReporter(arg);
case 'openProcessExplorer':
return this.service.openProcessExplorer(arg);
case 'getSystemStatus':
return this.service.getSystemStatus();
}
throw new Error(`Call not found: ${command}`);
}
}