Merge VS Code 1.31.1 (#4283)

This commit is contained in:
Matt Irvine
2019-03-15 13:09:45 -07:00
committed by GitHub
parent 7d31575149
commit 86bac90001
1716 changed files with 53308 additions and 48375 deletions

View File

@@ -3,33 +3,41 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { Event, filterEvent, mapEvent, anyEvent } from 'vs/base/common/event';
import { TPromise } from 'vs/base/common/winjs.base';
import { IWindowService, IWindowsService, INativeOpenDialogOptions, IEnterWorkspaceResult, IMessageBoxResult, IWindowConfiguration, IDevToolsOptions } from 'vs/platform/windows/common/windows';
import { Event } from 'vs/base/common/event';
import { IWindowService, IWindowsService, INativeOpenDialogOptions, IEnterWorkspaceResult, IMessageBoxResult, IWindowConfiguration, IDevToolsOptions, IOpenSettings } from 'vs/platform/windows/common/windows';
import { IRecentlyOpened } from 'vs/platform/history/common/history';
import { ISerializableCommandAction } from 'vs/platform/actions/common/actions';
import { IWorkspaceFolderCreationData } from 'vs/platform/workspaces/common/workspaces';
import { ParsedArgs } from 'vs/platform/environment/common/environment';
import { URI } from 'vs/base/common/uri';
import { Disposable } from 'vs/base/common/lifecycle';
export class WindowService implements IWindowService {
export class WindowService extends Disposable implements IWindowService {
readonly onDidChangeFocus: Event<boolean>;
readonly onDidChangeMaximize: Event<boolean>;
_serviceBrand: any;
private _hasFocus: boolean;
get hasFocus(): boolean { return this._hasFocus; }
constructor(
private windowId: number,
private configuration: IWindowConfiguration,
@IWindowsService private windowsService: IWindowsService
@IWindowsService private readonly windowsService: IWindowsService
) {
const onThisWindowFocus = mapEvent(filterEvent(windowsService.onWindowFocus, id => id === windowId), _ => true);
const onThisWindowBlur = mapEvent(filterEvent(windowsService.onWindowBlur, id => id === windowId), _ => false);
const onThisWindowMaximize = mapEvent(filterEvent(windowsService.onWindowMaximize, id => id === windowId), _ => true);
const onThisWindowUnmaximize = mapEvent(filterEvent(windowsService.onWindowUnmaximize, id => id === windowId), _ => false);
this.onDidChangeFocus = anyEvent(onThisWindowFocus, onThisWindowBlur);
this.onDidChangeMaximize = anyEvent(onThisWindowMaximize, onThisWindowUnmaximize);
super();
const onThisWindowFocus = Event.map(Event.filter(windowsService.onWindowFocus, id => id === windowId), _ => true);
const onThisWindowBlur = Event.map(Event.filter(windowsService.onWindowBlur, id => id === windowId), _ => false);
const onThisWindowMaximize = Event.map(Event.filter(windowsService.onWindowMaximize, id => id === windowId), _ => true);
const onThisWindowUnmaximize = Event.map(Event.filter(windowsService.onWindowUnmaximize, id => id === windowId), _ => false);
this.onDidChangeFocus = Event.any(onThisWindowFocus, onThisWindowBlur);
this.onDidChangeMaximize = Event.any(onThisWindowMaximize, onThisWindowUnmaximize);
this._hasFocus = document.hasFocus();
this.isFocused().then(focused => this._hasFocus = focused);
this._register(this.onDidChangeFocus(focus => this._hasFocus = focus));
}
getCurrentWindowId(): number {
@@ -40,127 +48,119 @@ export class WindowService implements IWindowService {
return this.configuration;
}
pickFileFolderAndOpen(options: INativeOpenDialogOptions): TPromise<void> {
pickFileFolderAndOpen(options: INativeOpenDialogOptions): Promise<void> {
options.windowId = this.windowId;
return this.windowsService.pickFileFolderAndOpen(options);
}
pickFileAndOpen(options: INativeOpenDialogOptions): TPromise<void> {
pickFileAndOpen(options: INativeOpenDialogOptions): Promise<void> {
options.windowId = this.windowId;
return this.windowsService.pickFileAndOpen(options);
}
pickFolderAndOpen(options: INativeOpenDialogOptions): TPromise<void> {
pickFolderAndOpen(options: INativeOpenDialogOptions): Promise<void> {
options.windowId = this.windowId;
return this.windowsService.pickFolderAndOpen(options);
}
pickWorkspaceAndOpen(options: INativeOpenDialogOptions): TPromise<void> {
pickWorkspaceAndOpen(options: INativeOpenDialogOptions): Promise<void> {
options.windowId = this.windowId;
return this.windowsService.pickWorkspaceAndOpen(options);
}
reloadWindow(args?: ParsedArgs): TPromise<void> {
reloadWindow(args?: ParsedArgs): Promise<void> {
return this.windowsService.reloadWindow(this.windowId, args);
}
openDevTools(options?: IDevToolsOptions): TPromise<void> {
openDevTools(options?: IDevToolsOptions): Promise<void> {
return this.windowsService.openDevTools(this.windowId, options);
}
toggleDevTools(): TPromise<void> {
toggleDevTools(): Promise<void> {
return this.windowsService.toggleDevTools(this.windowId);
}
closeWorkspace(): TPromise<void> {
closeWorkspace(): Promise<void> {
return this.windowsService.closeWorkspace(this.windowId);
}
enterWorkspace(path: string): TPromise<IEnterWorkspaceResult> {
enterWorkspace(path: URI): Promise<IEnterWorkspaceResult | undefined> {
return this.windowsService.enterWorkspace(this.windowId, path);
}
createAndEnterWorkspace(folders?: IWorkspaceFolderCreationData[], path?: string): TPromise<IEnterWorkspaceResult> {
return this.windowsService.createAndEnterWorkspace(this.windowId, folders, path);
}
saveAndEnterWorkspace(path: string): TPromise<IEnterWorkspaceResult> {
return this.windowsService.saveAndEnterWorkspace(this.windowId, path);
}
openWindow(paths: URI[], options?: { forceNewWindow?: boolean, forceReuseWindow?: boolean, forceOpenWorkspaceAsFile?: boolean, args?: ParsedArgs }): TPromise<void> {
openWindow(paths: URI[], options?: IOpenSettings): Promise<void> {
return this.windowsService.openWindow(this.windowId, paths, options);
}
closeWindow(): TPromise<void> {
closeWindow(): Promise<void> {
return this.windowsService.closeWindow(this.windowId);
}
toggleFullScreen(): TPromise<void> {
toggleFullScreen(): Promise<void> {
return this.windowsService.toggleFullScreen(this.windowId);
}
setRepresentedFilename(fileName: string): TPromise<void> {
setRepresentedFilename(fileName: string): Promise<void> {
return this.windowsService.setRepresentedFilename(this.windowId, fileName);
}
getRecentlyOpened(): TPromise<IRecentlyOpened> {
getRecentlyOpened(): Promise<IRecentlyOpened> {
return this.windowsService.getRecentlyOpened(this.windowId);
}
focusWindow(): TPromise<void> {
focusWindow(): Promise<void> {
return this.windowsService.focusWindow(this.windowId);
}
isFocused(): TPromise<boolean> {
isFocused(): Promise<boolean> {
return this.windowsService.isFocused(this.windowId);
}
isMaximized(): TPromise<boolean> {
isMaximized(): Promise<boolean> {
return this.windowsService.isMaximized(this.windowId);
}
maximizeWindow(): TPromise<void> {
maximizeWindow(): Promise<void> {
return this.windowsService.maximizeWindow(this.windowId);
}
unmaximizeWindow(): TPromise<void> {
unmaximizeWindow(): Promise<void> {
return this.windowsService.unmaximizeWindow(this.windowId);
}
minimizeWindow(): TPromise<void> {
minimizeWindow(): Promise<void> {
return this.windowsService.minimizeWindow(this.windowId);
}
onWindowTitleDoubleClick(): TPromise<void> {
onWindowTitleDoubleClick(): Promise<void> {
return this.windowsService.onWindowTitleDoubleClick(this.windowId);
}
setDocumentEdited(flag: boolean): TPromise<void> {
setDocumentEdited(flag: boolean): Promise<void> {
return this.windowsService.setDocumentEdited(this.windowId, flag);
}
show(): TPromise<void> {
show(): Promise<void> {
return this.windowsService.showWindow(this.windowId);
}
showMessageBox(options: Electron.MessageBoxOptions): TPromise<IMessageBoxResult> {
showMessageBox(options: Electron.MessageBoxOptions): Promise<IMessageBoxResult> {
return this.windowsService.showMessageBox(this.windowId, options);
}
showSaveDialog(options: Electron.SaveDialogOptions): TPromise<string> {
showSaveDialog(options: Electron.SaveDialogOptions): Promise<string> {
return this.windowsService.showSaveDialog(this.windowId, options);
}
showOpenDialog(options: Electron.OpenDialogOptions): TPromise<string[]> {
showOpenDialog(options: Electron.OpenDialogOptions): Promise<string[]> {
return this.windowsService.showOpenDialog(this.windowId, options);
}
updateTouchBar(items: ISerializableCommandAction[][]): TPromise<void> {
updateTouchBar(items: ISerializableCommandAction[][]): Promise<void> {
return this.windowsService.updateTouchBar(this.windowId, items);
}