Initial VS Code 1.19 source merge (#571)

* Initial 1.19 xcopy

* Fix yarn build

* Fix numerous build breaks

* Next batch of build break fixes

* More build break fixes

* Runtime breaks

* Additional post merge fixes

* Fix windows setup file

* Fix test failures.

* Update license header blocks to refer to source eula
This commit is contained in:
Karl Burtram
2018-01-28 23:37:17 -08:00
committed by GitHub
parent 9a1ac20710
commit 251ae01c3e
8009 changed files with 93378 additions and 35634 deletions

View File

@@ -14,6 +14,7 @@ import { ParsedArgs } from 'vs/platform/environment/common/environment';
import { IWorkspaceIdentifier, IWorkspaceFolderCreationData } from 'vs/platform/workspaces/common/workspaces';
import { IRecentlyOpened } from 'vs/platform/history/common/history';
import { ICommandAction } from 'vs/platform/actions/common/actions';
import { PerformanceEntry } from 'vs/base/common/performance';
export const IWindowsService = createDecorator<IWindowsService>('windowsService');
@@ -21,7 +22,7 @@ export interface INativeOpenDialogOptions {
windowId?: number;
forceNewWindow?: boolean;
dialogOptions?: Electron.OpenDialogOptions;
dialogOptions?: OpenDialogOptions;
telemetryEventName?: string;
telemetryExtraData?: ITelemetryData;
@@ -32,6 +33,63 @@ export interface IEnterWorkspaceResult {
backupPath: string;
}
export interface CrashReporterStartOptions {
companyName?: string;
submitURL: string;
productName?: string;
uploadToServer?: boolean;
ignoreSystemCrashHandler?: boolean;
extra?: any;
crashesDirectory?: string;
}
export interface OpenDialogOptions {
title?: string;
defaultPath?: string;
buttonLabel?: string;
filters?: FileFilter[];
properties?: Array<'openFile' | 'openDirectory' | 'multiSelections' | 'showHiddenFiles' | 'createDirectory' | 'promptToCreate' | 'noResolveAliases' | 'treatPackageAsDirectory'>;
message?: string;
}
export interface FileFilter {
extensions: string[];
name: string;
}
export interface MessageBoxOptions {
type?: string;
buttons?: string[];
defaultId?: number;
title?: string;
message: string;
detail?: string;
checkboxLabel?: string;
checkboxChecked?: boolean;
cancelId?: number;
noLink?: boolean;
normalizeAccessKeys?: boolean;
}
export interface SaveDialogOptions {
title?: string;
defaultPath?: string;
buttonLabel?: string;
filters?: FileFilter[];
message?: string;
nameFieldLabel?: string;
showsTagField?: boolean;
}
export interface OpenDialogOptions {
title?: string;
defaultPath?: string;
buttonLabel?: string;
filters?: FileFilter[];
properties?: Array<'openFile' | 'openDirectory' | 'multiSelections' | 'showHiddenFiles' | 'createDirectory' | 'promptToCreate' | 'noResolveAliases' | 'treatPackageAsDirectory'>;
message?: string;
}
export interface IWindowsService {
_serviceBrand: any;
@@ -95,7 +153,7 @@ export interface IWindowsService {
openExternal(url: string): TPromise<boolean>;
// TODO: this is a bit backwards
startCrashReporter(config: Electron.CrashReporterStartOptions): TPromise<void>;
startCrashReporter(config: CrashReporterStartOptions): TPromise<void>;
}
export const IWindowService = createDecorator<IWindowService>('windowService');
@@ -111,6 +169,7 @@ export interface IWindowService {
onDidChangeFocus: Event<boolean>;
getConfiguration(): IWindowConfiguration;
getCurrentWindowId(): number;
pickFileFolderAndOpen(options: INativeOpenDialogOptions): TPromise<void>;
pickFileAndOpen(options: INativeOpenDialogOptions): TPromise<void>;
@@ -130,15 +189,12 @@ export interface IWindowService {
closeWindow(): TPromise<void>;
isFocused(): TPromise<boolean>;
setDocumentEdited(flag: boolean): TPromise<void>;
isMaximized(): TPromise<boolean>;
maximizeWindow(): TPromise<void>;
unmaximizeWindow(): TPromise<void>;
onWindowTitleDoubleClick(): TPromise<void>;
show(): TPromise<void>;
showMessageBoxSync(options: Electron.MessageBoxOptions): number;
showMessageBox(options: Electron.MessageBoxOptions): TPromise<IMessageBoxResult>;
showSaveDialog(options: Electron.SaveDialogOptions, callback?: (fileName: string) => void): string;
showOpenDialog(options: Electron.OpenDialogOptions, callback?: (fileNames: string[]) => void): string[];
showMessageBox(options: MessageBoxOptions): number;
showSaveDialog(options: SaveDialogOptions): string;
showOpenDialog(options: OpenDialogOptions): string[];
showMessageBoxWithCheckbox(options: MessageBoxOptions): TPromise<IMessageBoxResult>;
}
export type MenuBarVisibility = 'default' | 'visible' | 'toggle' | 'hidden';
@@ -236,6 +292,8 @@ export interface IAddFoldersRequest {
}
export interface IWindowConfiguration extends ParsedArgs, IOpenFileRequest {
machineId: string;
appRoot: string;
execPath: string;
isInitialStartup?: boolean;
@@ -255,6 +313,7 @@ export interface IWindowConfiguration extends ParsedArgs, IOpenFileRequest {
backgroundColor?: string;
accessibilitySupport?: boolean;
perfEntries: PerformanceEntry[];
perfStartTime?: number;
perfAppReady?: number;
perfWindowLoadTime?: number;
@@ -263,4 +322,4 @@ export interface IWindowConfiguration extends ParsedArgs, IOpenFileRequest {
export interface IRunActionInWindowRequest {
id: string;
from: 'menu' | 'touchbar' | 'mouse';
}
}

View File

@@ -8,7 +8,7 @@
import { TPromise } from 'vs/base/common/winjs.base';
import Event, { buffer } from 'vs/base/common/event';
import { IChannel, eventToCall, eventFromCall } from 'vs/base/parts/ipc/common/ipc';
import { IWindowsService, INativeOpenDialogOptions, IEnterWorkspaceResult } from './windows';
import { IWindowsService, INativeOpenDialogOptions, IEnterWorkspaceResult, CrashReporterStartOptions } from 'vs/platform/windows/common/windows';
import { IWorkspaceIdentifier, ISingleFolderWorkspaceIdentifier, IWorkspaceFolderCreationData } from 'vs/platform/workspaces/common/workspaces';
import { IRecentlyOpened } from 'vs/platform/history/common/history';
import { ICommandAction } from 'vs/platform/actions/common/actions';
@@ -59,7 +59,7 @@ export interface IWindowsChannel extends IChannel {
call(command: 'log', arg: [string, string[]]): TPromise<void>;
call(command: 'showItemInFolder', arg: string): TPromise<void>;
call(command: 'openExternal', arg: string): TPromise<boolean>;
call(command: 'startCrashReporter', arg: Electron.CrashReporterStartOptions): TPromise<void>;
call(command: 'startCrashReporter', arg: CrashReporterStartOptions): TPromise<void>;
call(command: string, arg?: any): TPromise<any>;
}
@@ -101,7 +101,7 @@ export class WindowsChannel implements IWindowsChannel {
}
return this.service.createAndEnterWorkspace(arg[0], folders, arg[2]);
};
}
case 'saveAndEnterWorkspace': return this.service.saveAndEnterWorkspace(arg[0], arg[1]);
case 'toggleFullScreen': return this.service.toggleFullScreen(arg);
case 'setRepresentedFilename': return this.service.setRepresentedFilename(arg[0], arg[1]);
@@ -320,7 +320,7 @@ export class WindowsChannelClient implements IWindowsService {
return this.channel.call('openExternal', url);
}
startCrashReporter(config: Electron.CrashReporterStartOptions): TPromise<void> {
startCrashReporter(config: CrashReporterStartOptions): TPromise<void> {
return this.channel.call('startCrashReporter', config);
}

View File

@@ -7,7 +7,7 @@
import Event, { filterEvent, mapEvent, anyEvent } from 'vs/base/common/event';
import { TPromise } from 'vs/base/common/winjs.base';
import { IWindowService, IWindowsService, INativeOpenDialogOptions, IEnterWorkspaceResult, IMessageBoxResult } from 'vs/platform/windows/common/windows';
import { IWindowService, IWindowsService, INativeOpenDialogOptions, IEnterWorkspaceResult, IMessageBoxResult, IWindowConfiguration } from 'vs/platform/windows/common/windows';
import { remote } from 'electron';
import { IRecentlyOpened } from 'vs/platform/history/common/history';
import { ICommandAction } from 'vs/platform/actions/common/actions';
@@ -23,6 +23,7 @@ export class WindowService implements IWindowService {
constructor(
private windowId: number,
private configuration: IWindowConfiguration,
@IWindowsService private windowsService: IWindowsService
) {
const onThisWindowFocus = mapEvent(filterEvent(windowsService.onWindowFocus, id => id === windowId), _ => true);
@@ -34,6 +35,10 @@ export class WindowService implements IWindowService {
return this.windowId;
}
getConfiguration(): IWindowConfiguration {
return this.configuration;
}
pickFileFolderAndOpen(options: INativeOpenDialogOptions): TPromise<void> {
options.windowId = this.windowId;
@@ -106,18 +111,6 @@ export class WindowService implements IWindowService {
return this.windowsService.isFocused(this.windowId);
}
isMaximized(): TPromise<boolean> {
return this.windowsService.isMaximized(this.windowId);
}
maximizeWindow(): TPromise<void> {
return this.windowsService.maximizeWindow(this.windowId);
}
unmaximizeWindow(): TPromise<void> {
return this.windowsService.unmaximizeWindow(this.windowId);
}
onWindowTitleDoubleClick(): TPromise<void> {
return this.windowsService.onWindowTitleDoubleClick(this.windowId);
}
@@ -130,11 +123,11 @@ export class WindowService implements IWindowService {
return this.windowsService.showWindow(this.windowId);
}
showMessageBoxSync(options: Electron.MessageBoxOptions): number {
showMessageBox(options: Electron.MessageBoxOptions): number {
return remote.dialog.showMessageBox(remote.getCurrentWindow(), options);
}
showMessageBox(options: Electron.MessageBoxOptions): TPromise<IMessageBoxResult> {
showMessageBoxWithCheckbox(options: Electron.MessageBoxOptions): TPromise<IMessageBoxResult> {
return new TPromise((c, e) => {
return remote.dialog.showMessageBox(remote.getCurrentWindow(), options, (response: number, checkboxChecked: boolean) => {
c({ button: response, checkboxChecked });
@@ -142,7 +135,7 @@ export class WindowService implements IWindowService {
});
}
showSaveDialog(options: Electron.SaveDialogOptions, callback?: (fileName: string) => void): string {
showSaveDialog(options: Electron.SaveDialogOptions): string {
function normalizePath(path: string): string {
if (path && isMacintosh) {
@@ -152,14 +145,10 @@ export class WindowService implements IWindowService {
return path;
}
if (callback) {
return remote.dialog.showSaveDialog(remote.getCurrentWindow(), options, path => callback(normalizePath(path)));
}
return normalizePath(remote.dialog.showSaveDialog(remote.getCurrentWindow(), options)); // https://github.com/electron/electron/issues/4936
}
showOpenDialog(options: Electron.OpenDialogOptions, callback?: (fileNames: string[]) => void): string[] {
showOpenDialog(options: Electron.OpenDialogOptions): string[] {
function normalizePaths(paths: string[]): string[] {
if (paths && paths.length > 0 && isMacintosh) {
@@ -169,10 +158,6 @@ export class WindowService implements IWindowService {
return paths;
}
if (callback) {
return remote.dialog.showOpenDialog(remote.getCurrentWindow(), options, paths => callback(normalizePaths(paths)));
}
return normalizePaths(remote.dialog.showOpenDialog(remote.getCurrentWindow(), options)); // https://github.com/electron/electron/issues/4936
}

View File

@@ -12,8 +12,7 @@ import URI from 'vs/base/common/uri';
import { IWindowsService, OpenContext, INativeOpenDialogOptions, IEnterWorkspaceResult } from 'vs/platform/windows/common/windows';
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
import { shell, crashReporter, app, Menu } from 'electron';
import Event, { chain } from 'vs/base/common/event';
import { fromEventEmitter } from 'vs/base/node/event';
import Event, { chain, fromNodeEventEmitter } from 'vs/base/common/event';
import { IURLService } from 'vs/platform/url/common/url';
import { ILifecycleService } from 'vs/platform/lifecycle/electron-main/lifecycleMain';
import { IWindowsMainService, ISharedProcess } from 'vs/platform/windows/electron-main/windows';
@@ -27,9 +26,9 @@ export class WindowsService implements IWindowsService, IDisposable {
private disposables: IDisposable[] = [];
readonly onWindowOpen: Event<number> = fromEventEmitter(app, 'browser-window-created', (_, w: Electron.BrowserWindow) => w.id);
readonly onWindowFocus: Event<number> = fromEventEmitter(app, 'browser-window-focus', (_, w: Electron.BrowserWindow) => w.id);
readonly onWindowBlur: Event<number> = fromEventEmitter(app, 'browser-window-blur', (_, w: Electron.BrowserWindow) => w.id);
readonly onWindowOpen: Event<number> = fromNodeEventEmitter(app, 'browser-window-created', (_, w: Electron.BrowserWindow) => w.id);
readonly onWindowFocus: Event<number> = fromNodeEventEmitter(app, 'browser-window-focus', (_, w: Electron.BrowserWindow) => w.id);
readonly onWindowBlur: Event<number> = fromNodeEventEmitter(app, 'browser-window-blur', (_, w: Electron.BrowserWindow) => w.id);
constructor(
private sharedProcess: ISharedProcess,