Merge VS Code 1.21 source code (#1067)

* Initial VS Code 1.21 file copy with patches

* A few more merges

* Post npm install

* Fix batch of build breaks

* Fix more build breaks

* Fix more build errors

* Fix more build breaks

* Runtime fixes 1

* Get connection dialog working with some todos

* Fix a few packaging issues

* Copy several node_modules to package build to fix loader issues

* Fix breaks from master

* A few more fixes

* Make tests pass

* First pass of license header updates

* Second pass of license header updates

* Fix restore dialog issues

* Remove add additional themes menu items

* fix select box issues where the list doesn't show up

* formatting

* Fix editor dispose issue

* Copy over node modules to correct location on all platforms
This commit is contained in:
Karl Burtram
2018-04-04 15:27:51 -07:00
committed by GitHub
parent 5fba3e31b4
commit dafb780987
9412 changed files with 141255 additions and 98813 deletions

View File

@@ -0,0 +1,64 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import { TPromise } from 'vs/base/common/winjs.base';
import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
import { ILocalExtension } from 'vs/platform/extensionManagement/common/extensionManagement';
export const IIssueService = createDecorator<IIssueService>('issueService');
export enum IssueType {
Bug,
PerformanceIssue,
FeatureRequest,
SettingsSearchIssue
}
export interface IssueReporterStyles {
backgroundColor: string;
color: string;
textLinkColor: string;
inputBackground: string;
inputForeground: string;
inputBorder: string;
inputErrorBorder: string;
inputActiveBorder: string;
buttonBackground: string;
buttonForeground: string;
buttonHoverBackground: string;
sliderBackgroundColor: string;
sliderHoverColor: string;
sliderActiveColor: string;
}
export interface IssueReporterData {
styles: IssueReporterStyles;
zoomLevel: number;
enabledExtensions: ILocalExtension[];
issueType?: IssueType;
}
export interface ISettingSearchResult {
extensionId: string;
key: string;
score: number;
}
export interface ISettingsSearchIssueReporterData extends IssueReporterData {
issueType: IssueType.SettingsSearchIssue;
actualSearchResults: ISettingSearchResult[];
query: string;
filterResultCount: number;
}
export interface IssueReporterFeatures {
}
export interface IIssueService {
_serviceBrand: any;
openReporter(data: IssueReporterData): TPromise<void>;
}

View File

@@ -0,0 +1,40 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import { TPromise } from 'vs/base/common/winjs.base';
import { IChannel } from 'vs/base/parts/ipc/common/ipc';
import { IIssueService, IssueReporterData } from './issue';
export interface IIssueChannel extends IChannel {
call(command: 'openIssueReporter', arg: IssueReporterData): TPromise<void>;
call(command: 'getStatusInfo'): TPromise<any>;
call(command: string, arg?: any): TPromise<any>;
}
export class IssueChannel implements IIssueChannel {
constructor(private service: IIssueService) { }
call(command: string, arg?: any): TPromise<any> {
switch (command) {
case 'openIssueReporter':
return this.service.openReporter(arg);
}
return undefined;
}
}
export class IssueChannelClient implements IIssueService {
_serviceBrand: any;
constructor(private channel: IIssueChannel) { }
openReporter(data: IssueReporterData): TPromise<void> {
return this.channel.call('openIssueReporter', data);
}
}

View File

@@ -0,0 +1,188 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import { TPromise, Promise } from 'vs/base/common/winjs.base';
import { localize } from 'vs/nls';
import * as objects from 'vs/base/common/objects';
import { parseArgs } from 'vs/platform/environment/node/argv';
import { IIssueService, IssueReporterData, IssueReporterFeatures } from 'vs/platform/issue/common/issue';
import { BrowserWindow, ipcMain, screen } from 'electron';
import { ILaunchService } from 'vs/code/electron-main/launch';
import { getPerformanceInfo, PerformanceInfo, getSystemInfo, SystemInfo } from 'vs/code/electron-main/diagnostics';
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
import { isMacintosh } from 'vs/base/common/platform';
import { ILogService } from 'vs/platform/log/common/log';
const DEFAULT_BACKGROUND_COLOR = '#1E1E1E';
export class IssueService implements IIssueService {
_serviceBrand: any;
_issueWindow: BrowserWindow;
_parentWindow: BrowserWindow;
constructor(
private machineId: string,
@IEnvironmentService private environmentService: IEnvironmentService,
@ILaunchService private launchService: ILaunchService,
@ILogService private logService: ILogService
) { }
openReporter(data: IssueReporterData): TPromise<void> {
ipcMain.on('issueSystemInfoRequest', event => {
this.getSystemInformation().then(msg => {
event.sender.send('issueSystemInfoResponse', msg);
});
});
ipcMain.on('issuePerformanceInfoRequest', event => {
this.getPerformanceInfo().then(msg => {
event.sender.send('issuePerformanceInfoResponse', msg);
});
});
ipcMain.on('workbenchCommand', (event, arg) => {
this._parentWindow.webContents.send('vscode:runAction', { id: arg, from: 'issueReporter' });
});
this._parentWindow = BrowserWindow.getFocusedWindow();
const position = this.getWindowPosition();
this._issueWindow = new BrowserWindow({
width: position.width,
height: position.height,
minWidth: 300,
minHeight: 200,
x: position.x,
y: position.y,
title: localize('issueReporter', "Issue Reporter"),
backgroundColor: data.styles.backgroundColor || DEFAULT_BACKGROUND_COLOR
});
this._issueWindow.setMenuBarVisibility(false); // workaround for now, until a menu is implemented
// Modified when testing UI
const features: IssueReporterFeatures = {};
this.logService.trace('issueService#openReporter: opening issue reporter');
this._issueWindow.loadURL(this.getIssueReporterPath(data, features));
return TPromise.as(null);
}
private getWindowPosition() {
// We want the new window to open on the same display that the parent is in
let displayToUse: Electron.Display;
const displays = screen.getAllDisplays();
// Single Display
if (displays.length === 1) {
displayToUse = displays[0];
}
// Multi Display
else {
// on mac there is 1 menu per window so we need to use the monitor where the cursor currently is
if (isMacintosh) {
const cursorPoint = screen.getCursorScreenPoint();
displayToUse = screen.getDisplayNearestPoint(cursorPoint);
}
// if we have a last active window, use that display for the new window
if (!displayToUse && this._parentWindow) {
displayToUse = screen.getDisplayMatching(this._parentWindow.getBounds());
}
// fallback to primary display or first display
if (!displayToUse) {
displayToUse = screen.getPrimaryDisplay() || displays[0];
}
}
let state = {
width: 800,
height: 900,
x: undefined,
y: undefined
};
const displayBounds = displayToUse.bounds;
state.x = displayBounds.x + (displayBounds.width / 2) - (state.width / 2);
state.y = displayBounds.y + (displayBounds.height / 2) - (state.height / 2);
if (displayBounds.width > 0 && displayBounds.height > 0 /* Linux X11 sessions sometimes report wrong display bounds */) {
if (state.x < displayBounds.x) {
state.x = displayBounds.x; // prevent window from falling out of the screen to the left
}
if (state.y < displayBounds.y) {
state.y = displayBounds.y; // prevent window from falling out of the screen to the top
}
if (state.x > (displayBounds.x + displayBounds.width)) {
state.x = displayBounds.x; // prevent window from falling out of the screen to the right
}
if (state.y > (displayBounds.y + displayBounds.height)) {
state.y = displayBounds.y; // prevent window from falling out of the screen to the bottom
}
if (state.width > displayBounds.width) {
state.width = displayBounds.width; // prevent window from exceeding display bounds width
}
if (state.height > displayBounds.height) {
state.height = displayBounds.height; // prevent window from exceeding display bounds height
}
}
return state;
}
private getSystemInformation(): TPromise<SystemInfo> {
return new Promise((resolve, reject) => {
this.launchService.getMainProcessInfo().then(info => {
resolve(getSystemInfo(info));
});
});
}
private getPerformanceInfo(): TPromise<PerformanceInfo> {
return new Promise((resolve, reject) => {
this.launchService.getMainProcessInfo().then(info => {
getPerformanceInfo(info)
.then(diagnosticInfo => {
resolve(diagnosticInfo);
})
.catch(err => {
this.logService.warn('issueService#getPerformanceInfo ', err.message);
reject(err);
});
});
});
}
private getIssueReporterPath(data: IssueReporterData, features: IssueReporterFeatures) {
const windowConfiguration = {
appRoot: this.environmentService.appRoot,
nodeCachedDataDir: this.environmentService.nodeCachedDataDir,
windowId: this._issueWindow.id,
machineId: this.machineId,
data,
features
};
const environment = parseArgs(process.argv);
const config = objects.assign(environment, windowConfiguration);
for (let key in config) {
if (config[key] === void 0 || 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))}`;
}
}