Merge from vscode 8e0f348413f4f616c23a88ae30030efa85811973 (#6381)

* Merge from vscode 8e0f348413f4f616c23a88ae30030efa85811973

* disable strict null check
This commit is contained in:
Anthony Dresser
2019-07-15 22:35:46 -07:00
committed by GitHub
parent f720ec642f
commit 0b7e7ddbf9
2406 changed files with 59140 additions and 35464 deletions

View File

@@ -9,14 +9,13 @@ import { parseArgs } from 'vs/platform/environment/node/argv';
import { IIssueService, IssueReporterData, IssueReporterFeatures, ProcessExplorerData } from 'vs/platform/issue/common/issue';
import { BrowserWindow, ipcMain, screen, Event, dialog } from 'electron';
import { ILaunchService } from 'vs/platform/launch/electron-main/launchService';
import { PerformanceInfo, IDiagnosticsService } from 'vs/platform/diagnostics/electron-main/diagnosticsService';
import { PerformanceInfo, IDiagnosticsService, isRemoteDiagnosticError } from 'vs/platform/diagnostics/common/diagnosticsService';
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
import { isMacintosh, IProcessEnvironment } from 'vs/base/common/platform';
import { ILogService } from 'vs/platform/log/common/log';
import { IWindowsService } from 'vs/platform/windows/common/windows';
import { IWindowState } from 'vs/platform/windows/electron-main/windows';
import { listProcesses } from 'vs/base/node/ps';
import { isRemoteDiagnosticError } from 'vs/platform/diagnostics/common/diagnosticsService';
const DEFAULT_BACKGROUND_COLOR = '#1E1E1E';
@@ -40,10 +39,14 @@ export class IssueService implements IIssueService {
}
private registerListeners(): void {
ipcMain.on('vscode:issueSystemInfoRequest', (event: Event) => {
this.diagnosticsService.getSystemInfo(this.launchService).then(msg => {
event.sender.send('vscode:issueSystemInfoResponse', msg);
});
ipcMain.on('vscode:issueSystemInfoRequest', async (event: Event) => {
Promise.all([this.launchService.getMainProcessInfo(), this.launchService.getRemoteDiagnostics({ includeProcesses: false, includeWorkspaceMetadata: false })])
.then(result => {
const [info, remoteData] = result;
this.diagnosticsService.getSystemInfo(info, remoteData).then(msg => {
event.sender.send('vscode:issueSystemInfoResponse', msg);
});
});
});
ipcMain.on('vscode:listProcesses', async (event: Event) => {
@@ -234,15 +237,8 @@ export class IssueService implements IIssueService {
data
};
const environment = parseArgs(process.argv);
const config = objects.assign(environment, windowConfiguration);
for (let key in config) {
if (config[key] === undefined || config[key] === null || config[key] === '') {
delete config[key]; // only send over properties that have a true value
}
}
this._processExplorerWindow.loadURL(`${require.toUrl('vs/code/electron-browser/processExplorer/processExplorer.html')}?config=${encodeURIComponent(JSON.stringify(config))}`);
this._processExplorerWindow.loadURL(
toLauchUrl('vs/code/electron-browser/processExplorer/processExplorer.html', windowConfiguration));
this._processExplorerWindow.on('close', () => this._processExplorerWindow = null);
@@ -262,8 +258,12 @@ export class IssueService implements IIssueService {
});
}
public getSystemStatus(): Promise<string> {
return this.diagnosticsService.getDiagnostics(this.launchService);
public async getSystemStatus(): Promise<string> {
return Promise.all([this.launchService.getMainProcessInfo(), this.launchService.getRemoteDiagnostics({ includeProcesses: false, includeWorkspaceMetadata: false })])
.then(result => {
const [info, remoteData] = result;
return this.diagnosticsService.getDiagnostics(info, remoteData);
});
}
private getWindowPosition(parentWindow: BrowserWindow, defaultWidth: number, defaultHeight: number): IWindowState {
@@ -335,14 +335,18 @@ export class IssueService implements IIssueService {
}
private getPerformanceInfo(): Promise<PerformanceInfo> {
return new Promise((resolve, reject) => {
this.diagnosticsService.getPerformanceInfo(this.launchService)
.then(diagnosticInfo => {
resolve(diagnosticInfo);
})
.catch(err => {
this.logService.warn('issueService#getPerformanceInfo ', err.message);
reject(err);
return new Promise(async (resolve, reject) => {
Promise.all([this.launchService.getMainProcessInfo(), this.launchService.getRemoteDiagnostics({ includeProcesses: true, includeWorkspaceMetadata: true })])
.then(result => {
const [info, remoteData] = result;
this.diagnosticsService.getPerformanceInfo(info, remoteData)
.then(diagnosticInfo => {
resolve(diagnosticInfo);
})
.catch(err => {
this.logService.warn('issueService#getPerformanceInfo ', err.message);
reject(err);
});
});
});
}
@@ -362,14 +366,19 @@ export class IssueService implements IIssueService {
features
};
const environment = parseArgs(process.argv);
const config = objects.assign(environment, windowConfiguration);
for (let key in config) {
if (config[key] === undefined || config[key] === null || config[key] === '') {
delete config[key]; // only send over properties that have a true value
}
}
return `${require.toUrl('vs/code/electron-browser/issue/issueReporter.html')}?config=${encodeURIComponent(JSON.stringify(config))}`;
return toLauchUrl('vs/code/electron-browser/issue/issueReporter.html', windowConfiguration);
}
}
}
function toLauchUrl<T>(pathToHtml: string, windowConfiguration: T): string {
const environment = parseArgs(process.argv);
const config = objects.assign(environment, windowConfiguration);
for (const keyValue of Object.keys(config)) {
const key = keyValue as keyof typeof config;
if (config[key] === undefined || config[key] === null || config[key] === '') {
delete config[key]; // only send over properties that have a true value
}
}
return `${require.toUrl(pathToHtml)}?config=${encodeURIComponent(JSON.stringify(config))}`;
}