Refresh master with initial release/0.24 snapshot (#332)

* Initial port of release/0.24 source code

* Fix additional headers

* Fix a typo in launch.json
This commit is contained in:
Karl Burtram
2017-12-15 15:38:57 -08:00
committed by GitHub
parent 271b3a0b82
commit 6ad0df0e3e
7118 changed files with 107999 additions and 56466 deletions

View File

@@ -11,8 +11,9 @@ import Event from 'vs/base/common/event';
import { ITelemetryData } from 'vs/platform/telemetry/common/telemetry';
import { IProcessEnvironment } from 'vs/base/common/platform';
import { ParsedArgs } from 'vs/platform/environment/common/environment';
import { IWorkspaceIdentifier } from 'vs/platform/workspaces/common/workspaces';
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';
export const IWindowsService = createDecorator<IWindowsService>('windowsService');
@@ -26,6 +27,11 @@ export interface INativeOpenDialogOptions {
telemetryExtraData?: ITelemetryData;
}
export interface IEnterWorkspaceResult {
workspace: IWorkspaceIdentifier;
backupPath: string;
}
export interface IWindowsService {
_serviceBrand: any;
@@ -37,13 +43,13 @@ export interface IWindowsService {
pickFileFolderAndOpen(options: INativeOpenDialogOptions): TPromise<void>;
pickFileAndOpen(options: INativeOpenDialogOptions): TPromise<void>;
pickFolderAndOpen(options: INativeOpenDialogOptions): TPromise<void>;
pickWorkspaceAndOpen(options: INativeOpenDialogOptions): TPromise<void>;
reloadWindow(windowId: number): TPromise<void>;
openDevTools(windowId: number): TPromise<void>;
toggleDevTools(windowId: number): TPromise<void>;
closeWorkspace(windowId: number): TPromise<void>;
openWorkspace(windowId: number): TPromise<void>;
createAndOpenWorkspace(windowId: number, folders?: string[], path?: string): TPromise<void>;
saveAndOpenWorkspace(windowId: number, path: string): TPromise<void>;
createAndEnterWorkspace(windowId: number, folders?: IWorkspaceFolderCreationData[], path?: string): TPromise<IEnterWorkspaceResult>;
saveAndEnterWorkspace(windowId: number, path: string): TPromise<IEnterWorkspaceResult>;
toggleFullScreen(windowId: number): TPromise<void>;
setRepresentedFilename(windowId: number, fileName: string): TPromise<void>;
addRecentlyOpened(files: string[]): TPromise<void>;
@@ -61,6 +67,16 @@ export interface IWindowsService {
quit(): TPromise<void>;
relaunch(options: { addArgs?: string[], removeArgs?: string[] }): TPromise<void>;
// macOS Native Tabs
showPreviousWindowTab(): TPromise<void>;
showNextWindowTab(): TPromise<void>;
moveWindowTabToNewWindow(): TPromise<void>;
mergeAllWindowTabs(): TPromise<void>;
toggleWindowTabsBar(): TPromise<void>;
// macOS TouchBar
updateTouchBar(windowId: number, items: ICommandAction[][]): TPromise<void>;
// Shared process
whenSharedProcessReady(): TPromise<void>;
toggleSharedProcess(): TPromise<void>;
@@ -84,6 +100,11 @@ export interface IWindowsService {
export const IWindowService = createDecorator<IWindowService>('windowService');
export interface IMessageBoxResult {
button: number;
checkboxChecked?: boolean;
}
export interface IWindowService {
_serviceBrand: any;
@@ -94,13 +115,14 @@ export interface IWindowService {
pickFileFolderAndOpen(options: INativeOpenDialogOptions): TPromise<void>;
pickFileAndOpen(options: INativeOpenDialogOptions): TPromise<void>;
pickFolderAndOpen(options: INativeOpenDialogOptions): TPromise<void>;
pickWorkspaceAndOpen(options: INativeOpenDialogOptions): TPromise<void>;
reloadWindow(): TPromise<void>;
openDevTools(): TPromise<void>;
toggleDevTools(): TPromise<void>;
closeWorkspace(): TPromise<void>;
openWorkspace(): TPromise<void>;
createAndOpenWorkspace(folders?: string[], path?: string): TPromise<void>;
saveAndOpenWorkspace(path: string): TPromise<void>;
updateTouchBar(items: ICommandAction[][]): TPromise<void>;
createAndEnterWorkspace(folders?: IWorkspaceFolderCreationData[], path?: string): TPromise<IEnterWorkspaceResult>;
saveAndEnterWorkspace(path: string): TPromise<IEnterWorkspaceResult>;
toggleFullScreen(): TPromise<void>;
setRepresentedFilename(fileName: string): TPromise<void>;
getRecentlyOpened(): TPromise<IRecentlyOpened>;
@@ -113,7 +135,8 @@ export interface IWindowService {
unmaximizeWindow(): TPromise<void>;
onWindowTitleDoubleClick(): TPromise<void>;
show(): TPromise<void>;
showMessageBox(options: Electron.ShowMessageBoxOptions): number;
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[];
}
@@ -196,10 +219,16 @@ export interface IPath {
columnNumber?: number;
}
export interface IPathsToWaitFor {
paths: IPath[];
waitMarkerFilePath: string;
}
export interface IOpenFileRequest {
filesToOpen?: IPath[];
filesToCreate?: IPath[];
filesToDiff?: IPath[];
filesToWait?: IPathsToWaitFor;
}
export interface IAddFoldersRequest {
@@ -219,7 +248,6 @@ export interface IWindowConfiguration extends ParsedArgs, IOpenFileRequest {
workspace?: IWorkspaceIdentifier;
folderPath?: string;
isISOKeyboard?: boolean;
zoomLevel?: number;
fullscreen?: boolean;
highContrast?: boolean;
@@ -230,4 +258,9 @@ export interface IWindowConfiguration extends ParsedArgs, IOpenFileRequest {
perfStartTime?: number;
perfAppReady?: number;
perfWindowLoadTime?: number;
}
export interface IRunActionInWindowRequest {
id: string;
from: 'menu' | 'touchbar' | 'mouse';
}

View File

@@ -8,9 +8,11 @@
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 } from './windows';
import { IWorkspaceIdentifier, ISingleFolderWorkspaceIdentifier } from 'vs/platform/workspaces/common/workspaces';
import { IWindowsService, INativeOpenDialogOptions, IEnterWorkspaceResult } from './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';
import URI from 'vs/base/common/uri';
export interface IWindowsChannel extends IChannel {
call(command: 'event:onWindowOpen'): TPromise<number>;
@@ -19,18 +21,24 @@ export interface IWindowsChannel extends IChannel {
call(command: 'pickFileFolderAndOpen', arg: INativeOpenDialogOptions): TPromise<void>;
call(command: 'pickFileAndOpen', arg: INativeOpenDialogOptions): TPromise<void>;
call(command: 'pickFolderAndOpen', arg: INativeOpenDialogOptions): TPromise<void>;
call(command: 'pickWorkspaceAndOpen', arg: INativeOpenDialogOptions): TPromise<void>;
call(command: 'reloadWindow', arg: number): TPromise<void>;
call(command: 'toggleDevTools', arg: number): TPromise<void>;
call(command: 'closeWorkspace', arg: number): TPromise<void>;
call(command: 'openWorkspace', arg: number): TPromise<void>;
call(command: 'createAndOpenWorkspace', arg: [number, string[], string]): TPromise<void>;
call(command: 'saveAndOpenWorkspace', arg: [number, string]): TPromise<void>;
call(command: 'createAndEnterWorkspace', arg: [number, IWorkspaceFolderCreationData[], string]): TPromise<IEnterWorkspaceResult>;
call(command: 'saveAndEnterWorkspace', arg: [number, string]): TPromise<IEnterWorkspaceResult>;
call(command: 'toggleFullScreen', arg: number): TPromise<void>;
call(command: 'setRepresentedFilename', arg: [number, string]): TPromise<void>;
call(command: 'addRecentlyOpened', arg: string[]): TPromise<void>;
call(command: 'removeFromRecentlyOpened', arg: (IWorkspaceIdentifier | ISingleFolderWorkspaceIdentifier)[]): TPromise<void>;
call(command: 'clearRecentlyOpened'): TPromise<void>;
call(command: 'getRecentlyOpened', arg: number): TPromise<IRecentlyOpened>;
call(command: 'showPreviousWindowTab', arg: number): TPromise<void>;
call(command: 'showNextWindowTab', arg: number): TPromise<void>;
call(command: 'moveWindowTabToNewWindow', arg: number): TPromise<void>;
call(command: 'mergeAllWindowTabs', arg: number): TPromise<void>;
call(command: 'toggleWindowTabsBar', arg: number): TPromise<void>;
call(command: 'updateTouchBar', arg: [number, ICommandAction[][]]): TPromise<void>;
call(command: 'focusWindow', arg: number): TPromise<void>;
call(command: 'closeWindow', arg: number): TPromise<void>;
call(command: 'isFocused', arg: number): TPromise<boolean>;
@@ -75,18 +83,37 @@ export class WindowsChannel implements IWindowsChannel {
case 'pickFileFolderAndOpen': return this.service.pickFileFolderAndOpen(arg);
case 'pickFileAndOpen': return this.service.pickFileAndOpen(arg);
case 'pickFolderAndOpen': return this.service.pickFolderAndOpen(arg);
case 'pickWorkspaceAndOpen': return this.service.pickWorkspaceAndOpen(arg);
case 'reloadWindow': return this.service.reloadWindow(arg);
case 'openDevTools': return this.service.openDevTools(arg);
case 'toggleDevTools': return this.service.toggleDevTools(arg);
case 'closeWorkspace': return this.service.closeWorkspace(arg);
case 'openWorkspace': return this.service.openWorkspace(arg);
case 'createAndOpenWorkspace': return this.service.createAndOpenWorkspace(arg[0], arg[1], arg[2]);
case 'saveAndOpenWorkspace': return this.service.saveAndOpenWorkspace(arg[0], arg[1]);
case 'createAndEnterWorkspace': {
const rawFolders: IWorkspaceFolderCreationData[] = arg[1];
let folders: IWorkspaceFolderCreationData[];
if (Array.isArray(rawFolders)) {
folders = rawFolders.map(rawFolder => {
return {
uri: URI.revive(rawFolder.uri), // convert raw URI back to real URI
name: rawFolder.name
} as IWorkspaceFolderCreationData;
});
}
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]);
case 'addRecentlyOpened': return this.service.addRecentlyOpened(arg);
case 'removeFromRecentlyOpened': return this.service.removeFromRecentlyOpened(arg);
case 'clearRecentlyOpened': return this.service.clearRecentlyOpened();
case 'showPreviousWindowTab': return this.service.showPreviousWindowTab();
case 'showNextWindowTab': return this.service.showNextWindowTab();
case 'moveWindowTabToNewWindow': return this.service.moveWindowTabToNewWindow();
case 'mergeAllWindowTabs': return this.service.mergeAllWindowTabs();
case 'toggleWindowTabsBar': return this.service.toggleWindowTabsBar();
case 'updateTouchBar': return this.service.updateTouchBar(arg[0], arg[1]);
case 'getRecentlyOpened': return this.service.getRecentlyOpened(arg);
case 'focusWindow': return this.service.focusWindow(arg);
case 'closeWindow': return this.service.closeWindow(arg);
@@ -141,6 +168,10 @@ export class WindowsChannelClient implements IWindowsService {
return this.channel.call('pickFolderAndOpen', options);
}
pickWorkspaceAndOpen(options: INativeOpenDialogOptions): TPromise<void> {
return this.channel.call('pickWorkspaceAndOpen', options);
}
reloadWindow(windowId: number): TPromise<void> {
return this.channel.call('reloadWindow', windowId);
}
@@ -157,16 +188,12 @@ export class WindowsChannelClient implements IWindowsService {
return this.channel.call('closeWorkspace', windowId);
}
openWorkspace(windowId: number): TPromise<void> {
return this.channel.call('openWorkspace', windowId);
createAndEnterWorkspace(windowId: number, folders?: IWorkspaceFolderCreationData[], path?: string): TPromise<IEnterWorkspaceResult> {
return this.channel.call('createAndEnterWorkspace', [windowId, folders, path]);
}
createAndOpenWorkspace(windowId: number, folders?: string[], path?: string): TPromise<void> {
return this.channel.call('createAndOpenWorkspace', [windowId, folders, path]);
}
saveAndOpenWorkspace(windowId: number, path: string): TPromise<void> {
return this.channel.call('saveAndOpenWorkspace', [windowId, path]);
saveAndEnterWorkspace(windowId: number, path: string): TPromise<IEnterWorkspaceResult> {
return this.channel.call('saveAndEnterWorkspace', [windowId, path]);
}
toggleFullScreen(windowId: number): TPromise<void> {
@@ -193,6 +220,26 @@ export class WindowsChannelClient implements IWindowsService {
return this.channel.call('getRecentlyOpened', windowId);
}
showPreviousWindowTab(): TPromise<void> {
return this.channel.call('showPreviousWindowTab');
}
showNextWindowTab(): TPromise<void> {
return this.channel.call('showNextWindowTab');
}
moveWindowTabToNewWindow(): TPromise<void> {
return this.channel.call('moveWindowTabToNewWindow');
}
mergeAllWindowTabs(): TPromise<void> {
return this.channel.call('mergeAllWindowTabs');
}
toggleWindowTabsBar(): TPromise<void> {
return this.channel.call('toggleWindowTabsBar');
}
focusWindow(windowId: number): TPromise<void> {
return this.channel.call('focusWindow', windowId);
}
@@ -276,4 +323,8 @@ export class WindowsChannelClient implements IWindowsService {
startCrashReporter(config: Electron.CrashReporterStartOptions): TPromise<void> {
return this.channel.call('startCrashReporter', config);
}
updateTouchBar(windowId: number, items: ICommandAction[][]): TPromise<void> {
return this.channel.call('updateTouchBar', [windowId, items]);
}
}

View File

@@ -5,11 +5,15 @@
'use strict';
import Event, { filterEvent, mapEvent, any } from 'vs/base/common/event';
import Event, { filterEvent, mapEvent, anyEvent } from 'vs/base/common/event';
import { TPromise } from 'vs/base/common/winjs.base';
import { IWindowService, IWindowsService, INativeOpenDialogOptions } from 'vs/platform/windows/common/windows';
import { IWindowService, IWindowsService, INativeOpenDialogOptions, IEnterWorkspaceResult, IMessageBoxResult } 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';
import { isMacintosh } from 'vs/base/common/platform';
import { normalizeNFC } from 'vs/base/common/strings';
import { IWorkspaceFolderCreationData } from 'vs/platform/workspaces/common/workspaces';
export class WindowService implements IWindowService {
@@ -23,7 +27,7 @@ export class WindowService implements IWindowService {
) {
const onThisWindowFocus = mapEvent(filterEvent(windowsService.onWindowFocus, id => id === windowId), _ => true);
const onThisWindowBlur = mapEvent(filterEvent(windowsService.onWindowBlur, id => id === windowId), _ => false);
this.onDidChangeFocus = any(onThisWindowFocus, onThisWindowBlur);
this.onDidChangeFocus = anyEvent(onThisWindowFocus, onThisWindowBlur);
}
getCurrentWindowId(): number {
@@ -48,6 +52,12 @@ export class WindowService implements IWindowService {
return this.windowsService.pickFolderAndOpen(options);
}
pickWorkspaceAndOpen(options: INativeOpenDialogOptions): TPromise<void> {
options.windowId = this.windowId;
return this.windowsService.pickWorkspaceAndOpen(options);
}
reloadWindow(): TPromise<void> {
return this.windowsService.reloadWindow(this.windowId);
}
@@ -64,16 +74,12 @@ export class WindowService implements IWindowService {
return this.windowsService.closeWorkspace(this.windowId);
}
openWorkspace(): TPromise<void> {
return this.windowsService.openWorkspace(this.windowId);
createAndEnterWorkspace(folders?: IWorkspaceFolderCreationData[], path?: string): TPromise<IEnterWorkspaceResult> {
return this.windowsService.createAndEnterWorkspace(this.windowId, folders, path);
}
createAndOpenWorkspace(folders?: string[], path?: string): TPromise<void> {
return this.windowsService.createAndOpenWorkspace(this.windowId, folders, path);
}
saveAndOpenWorkspace(path: string): TPromise<void> {
return this.windowsService.saveAndOpenWorkspace(this.windowId, path);
saveAndEnterWorkspace(path: string): TPromise<IEnterWorkspaceResult> {
return this.windowsService.saveAndEnterWorkspace(this.windowId, path);
}
closeWindow(): TPromise<void> {
@@ -124,23 +130,53 @@ export class WindowService implements IWindowService {
return this.windowsService.showWindow(this.windowId);
}
showMessageBox(options: Electron.ShowMessageBoxOptions): number {
showMessageBoxSync(options: Electron.MessageBoxOptions): number {
return remote.dialog.showMessageBox(remote.getCurrentWindow(), options);
}
showMessageBox(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 });
});
});
}
showSaveDialog(options: Electron.SaveDialogOptions, callback?: (fileName: string) => void): string {
if (callback) {
return remote.dialog.showSaveDialog(remote.getCurrentWindow(), options, callback);
function normalizePath(path: string): string {
if (path && isMacintosh) {
path = normalizeNFC(path); // normalize paths returned from the OS
}
return path;
}
return remote.dialog.showSaveDialog(remote.getCurrentWindow(), options); // https://github.com/electron/electron/issues/4936
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[] {
if (callback) {
return remote.dialog.showOpenDialog(remote.getCurrentWindow(), options, callback);
function normalizePaths(paths: string[]): string[] {
if (paths && paths.length > 0 && isMacintosh) {
paths = paths.map(path => normalizeNFC(path)); // normalize paths returned from the OS
}
return paths;
}
return remote.dialog.showOpenDialog(remote.getCurrentWindow(), options); // https://github.com/electron/electron/issues/4936
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
}
updateTouchBar(items: ICommandAction[][]): TPromise<void> {
return this.windowsService.updateTouchBar(this.windowId, items);
}
}

View File

@@ -6,12 +6,13 @@
'use strict';
import { TPromise } from 'vs/base/common/winjs.base';
import { OpenContext, IWindowConfiguration, ReadyState, INativeOpenDialogOptions } from 'vs/platform/windows/common/windows';
import { OpenContext, IWindowConfiguration, ReadyState, INativeOpenDialogOptions, IEnterWorkspaceResult } from 'vs/platform/windows/common/windows';
import { ParsedArgs } from 'vs/platform/environment/common/environment';
import Event from 'vs/base/common/event';
import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
import { IProcessEnvironment } from 'vs/base/common/platform';
import { IWorkspaceIdentifier } from 'vs/platform/workspaces/common/workspaces';
import { IWorkspaceIdentifier, IWorkspaceFolderCreationData } from 'vs/platform/workspaces/common/workspaces';
import { ICommandAction } from 'vs/platform/actions/common/actions';
export interface ICodeWindow {
id: number;
@@ -35,6 +36,8 @@ export interface ICodeWindow {
setRepresentedFilename(name: string): void;
getRepresentedFilename(): string;
onWindowTitleDoubleClick(): void;
updateTouchBar(items: ICommandAction[][]): void;
}
export const IWindowsMainService = createDecorator<IWindowsMainService>('windowsMainService');
@@ -57,18 +60,18 @@ export interface IWindowsMainService {
// methods
ready(initialUserEnv: IProcessEnvironment): void;
reload(win: ICodeWindow, cli?: ParsedArgs): void;
openWorkspace(win?: ICodeWindow): void;
createAndOpenWorkspace(win: ICodeWindow, folders?: string[], path?: string): void;
saveAndOpenWorkspace(win: ICodeWindow, path: string): void;
createAndEnterWorkspace(win: ICodeWindow, folders?: IWorkspaceFolderCreationData[], path?: string): TPromise<IEnterWorkspaceResult>;
saveAndEnterWorkspace(win: ICodeWindow, path: string): TPromise<IEnterWorkspaceResult>;
closeWorkspace(win: ICodeWindow): void;
open(openConfig: IOpenConfiguration): ICodeWindow[];
openExtensionDevelopmentHostWindow(openConfig: IOpenConfiguration): void;
pickFileFolderAndOpen(options: INativeOpenDialogOptions): void;
pickFolderAndOpen(options: INativeOpenDialogOptions): void;
pickFileAndOpen(options: INativeOpenDialogOptions): void;
pickWorkspaceAndOpen(options: INativeOpenDialogOptions): void;
focusLastActive(cli: ParsedArgs, context: OpenContext): ICodeWindow;
getLastActiveWindow(): ICodeWindow;
waitForWindowClose(windowId: number): TPromise<void>;
waitForWindowCloseOrLoad(windowId: number): TPromise<void>;
openNewWindow(context: OpenContext): void;
sendToFocused(channel: string, ...args: any[]): void;
sendToAll(channel: string, payload: any, windowIdsToIgnore?: number[]): void;

View File

@@ -9,16 +9,17 @@ import { TPromise } from 'vs/base/common/winjs.base';
import { IDisposable, dispose } from 'vs/base/common/lifecycle';
import { assign } from 'vs/base/common/objects';
import URI from 'vs/base/common/uri';
import { IWindowsService, OpenContext, INativeOpenDialogOptions } from 'vs/platform/windows/common/windows';
import { IWindowsService, OpenContext, INativeOpenDialogOptions, IEnterWorkspaceResult } from 'vs/platform/windows/common/windows';
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
import { shell, crashReporter, app } from 'electron';
import { shell, crashReporter, app, Menu } from 'electron';
import Event, { chain } from 'vs/base/common/event';
import { fromEventEmitter } from 'vs/base/node/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';
import { IHistoryMainService, IRecentlyOpened } from 'vs/platform/history/common/history';
import { IWorkspaceIdentifier } from 'vs/platform/workspaces/common/workspaces';
import { IWorkspaceIdentifier, IWorkspaceFolderCreationData } from 'vs/platform/workspaces/common/workspaces';
import { ICommandAction } from 'vs/platform/actions/common/actions';
export class WindowsService implements IWindowsService, IDisposable {
@@ -69,6 +70,12 @@ export class WindowsService implements IWindowsService, IDisposable {
return TPromise.as(null);
}
pickWorkspaceAndOpen(options: INativeOpenDialogOptions): TPromise<void> {
this.windowsMainService.pickWorkspaceAndOpen(options);
return TPromise.as(null);
}
reloadWindow(windowId: number): TPromise<void> {
const codeWindow = this.windowsMainService.getWindowById(windowId);
@@ -104,6 +111,16 @@ export class WindowsService implements IWindowsService, IDisposable {
return TPromise.as(null);
}
updateTouchBar(windowId: number, items: ICommandAction[][]): TPromise<void> {
const codeWindow = this.windowsMainService.getWindowById(windowId);
if (codeWindow) {
codeWindow.updateTouchBar(items);
}
return TPromise.as(null);
}
closeWorkspace(windowId: number): TPromise<void> {
const codeWindow = this.windowsMainService.getWindowById(windowId);
@@ -114,31 +131,21 @@ export class WindowsService implements IWindowsService, IDisposable {
return TPromise.as(null);
}
openWorkspace(windowId: number): TPromise<void> {
createAndEnterWorkspace(windowId: number, folders?: IWorkspaceFolderCreationData[], path?: string): TPromise<IEnterWorkspaceResult> {
const codeWindow = this.windowsMainService.getWindowById(windowId);
if (codeWindow) {
this.windowsMainService.openWorkspace(codeWindow);
return this.windowsMainService.createAndEnterWorkspace(codeWindow, folders, path);
}
return TPromise.as(null);
}
createAndOpenWorkspace(windowId: number, folders?: string[], path?: string): TPromise<void> {
saveAndEnterWorkspace(windowId: number, path: string): TPromise<IEnterWorkspaceResult> {
const codeWindow = this.windowsMainService.getWindowById(windowId);
if (codeWindow) {
this.windowsMainService.createAndOpenWorkspace(codeWindow, folders, path);
}
return TPromise.as(null);
}
saveAndOpenWorkspace(windowId: number, path: string): TPromise<void> {
const codeWindow = this.windowsMainService.getWindowById(windowId);
if (codeWindow) {
this.windowsMainService.saveAndOpenWorkspace(codeWindow, path);
return this.windowsMainService.saveAndEnterWorkspace(codeWindow, path);
}
return TPromise.as(null);
@@ -192,6 +199,36 @@ export class WindowsService implements IWindowsService, IDisposable {
return TPromise.as(this.historyService.getRecentlyOpened());
}
showPreviousWindowTab(): TPromise<void> {
Menu.sendActionToFirstResponder('selectPreviousTab:');
return TPromise.as(void 0);
}
showNextWindowTab(): TPromise<void> {
Menu.sendActionToFirstResponder('selectNextTab:');
return TPromise.as(void 0);
}
moveWindowTabToNewWindow(): TPromise<void> {
Menu.sendActionToFirstResponder('moveTabToNewWindow:');
return TPromise.as(void 0);
}
mergeAllWindowTabs(): TPromise<void> {
Menu.sendActionToFirstResponder('mergeAllWindows:');
return TPromise.as(void 0);
}
toggleWindowTabsBar(): TPromise<void> {
Menu.sendActionToFirstResponder('toggleTabBar:');
return TPromise.as(void 0);
}
focusWindow(windowId: number): TPromise<void> {
const codeWindow = this.windowsMainService.getWindowById(windowId);