mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-07 01:25:38 -05:00
Merge VS Code 1.31.1 (#4283)
This commit is contained in:
@@ -3,11 +3,10 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import { Event, buffer } from 'vs/base/common/event';
|
||||
import { Event } from 'vs/base/common/event';
|
||||
import { IChannel, IServerChannel } from 'vs/base/parts/ipc/node/ipc';
|
||||
import { IWindowsService, INativeOpenDialogOptions, IEnterWorkspaceResult, CrashReporterStartOptions, IMessageBoxResult, MessageBoxOptions, SaveDialogOptions, OpenDialogOptions, IDevToolsOptions, INewWindowOptions } from 'vs/platform/windows/common/windows';
|
||||
import { IWorkspaceIdentifier, IWorkspaceFolderCreationData, ISingleFolderWorkspaceIdentifier, isWorkspaceIdentifier } from 'vs/platform/workspaces/common/workspaces';
|
||||
import { IWorkspaceIdentifier, ISingleFolderWorkspaceIdentifier, isWorkspaceIdentifier } from 'vs/platform/workspaces/common/workspaces';
|
||||
import { IRecentlyOpened } from 'vs/platform/history/common/history';
|
||||
import { ISerializableCommandAction } from 'vs/platform/actions/common/actions';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
@@ -23,12 +22,12 @@ export class WindowsChannel implements IServerChannel {
|
||||
private onRecentlyOpenedChange: Event<void>;
|
||||
|
||||
constructor(private service: IWindowsService) {
|
||||
this.onWindowOpen = buffer(service.onWindowOpen, true);
|
||||
this.onWindowFocus = buffer(service.onWindowFocus, true);
|
||||
this.onWindowBlur = buffer(service.onWindowBlur, true);
|
||||
this.onWindowMaximize = buffer(service.onWindowMaximize, true);
|
||||
this.onWindowUnmaximize = buffer(service.onWindowUnmaximize, true);
|
||||
this.onRecentlyOpenedChange = buffer(service.onRecentlyOpenedChange, true);
|
||||
this.onWindowOpen = Event.buffer(service.onWindowOpen, true);
|
||||
this.onWindowFocus = Event.buffer(service.onWindowFocus, true);
|
||||
this.onWindowBlur = Event.buffer(service.onWindowBlur, true);
|
||||
this.onWindowMaximize = Event.buffer(service.onWindowMaximize, true);
|
||||
this.onWindowUnmaximize = Event.buffer(service.onWindowUnmaximize, true);
|
||||
this.onRecentlyOpenedChange = Event.buffer(service.onRecentlyOpenedChange, true);
|
||||
}
|
||||
|
||||
listen(_, event: string): Event<any> {
|
||||
@@ -44,7 +43,7 @@ export class WindowsChannel implements IServerChannel {
|
||||
throw new Error(`Event not found: ${event}`);
|
||||
}
|
||||
|
||||
call(_, command: string, arg?: any): Thenable<any> {
|
||||
call(_, command: string, arg?: any): Promise<any> {
|
||||
switch (command) {
|
||||
case 'pickFileFolderAndOpen': return this.service.pickFileFolderAndOpen(arg);
|
||||
case 'pickFileAndOpen': return this.service.pickFileAndOpen(arg);
|
||||
@@ -57,27 +56,12 @@ export class WindowsChannel implements IServerChannel {
|
||||
case 'openDevTools': return this.service.openDevTools(arg[0], arg[1]);
|
||||
case 'toggleDevTools': return this.service.toggleDevTools(arg);
|
||||
case 'closeWorkspace': return this.service.closeWorkspace(arg);
|
||||
case 'enterWorkspace': return this.service.enterWorkspace(arg[0], arg[1]);
|
||||
case 'createAndEnterWorkspace': {
|
||||
const rawFolders: IWorkspaceFolderCreationData[] = arg[1];
|
||||
let folders: IWorkspaceFolderCreationData[] | undefined = undefined;
|
||||
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 'enterWorkspace': return this.service.enterWorkspace(arg[0], URI.revive(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.map(URI.revive));
|
||||
case 'removeFromRecentlyOpened': {
|
||||
let paths: (IWorkspaceIdentifier | ISingleFolderWorkspaceIdentifier | URI | string)[] = arg;
|
||||
let paths: Array<IWorkspaceIdentifier | ISingleFolderWorkspaceIdentifier | URI | string> = arg;
|
||||
if (Array.isArray(paths)) {
|
||||
paths = paths.map(path => isWorkspaceIdentifier(path) || typeof path === 'string' ? path : URI.revive(path));
|
||||
}
|
||||
@@ -136,213 +120,205 @@ export class WindowsChannelClient implements IWindowsService {
|
||||
get onWindowUnmaximize(): Event<number> { return this.channel.listen('onWindowUnmaximize'); }
|
||||
get onRecentlyOpenedChange(): Event<void> { return this.channel.listen('onRecentlyOpenedChange'); }
|
||||
|
||||
pickFileFolderAndOpen(options: INativeOpenDialogOptions): TPromise<void> {
|
||||
return TPromise.wrap(this.channel.call('pickFileFolderAndOpen', options));
|
||||
pickFileFolderAndOpen(options: INativeOpenDialogOptions): Promise<void> {
|
||||
return this.channel.call('pickFileFolderAndOpen', options);
|
||||
}
|
||||
|
||||
pickFileAndOpen(options: INativeOpenDialogOptions): TPromise<void> {
|
||||
return TPromise.wrap(this.channel.call('pickFileAndOpen', options));
|
||||
pickFileAndOpen(options: INativeOpenDialogOptions): Promise<void> {
|
||||
return this.channel.call('pickFileAndOpen', options);
|
||||
}
|
||||
|
||||
pickFolderAndOpen(options: INativeOpenDialogOptions): TPromise<void> {
|
||||
return TPromise.wrap(this.channel.call('pickFolderAndOpen', options));
|
||||
pickFolderAndOpen(options: INativeOpenDialogOptions): Promise<void> {
|
||||
return this.channel.call('pickFolderAndOpen', options);
|
||||
}
|
||||
|
||||
pickWorkspaceAndOpen(options: INativeOpenDialogOptions): TPromise<void> {
|
||||
return TPromise.wrap(this.channel.call('pickWorkspaceAndOpen', options));
|
||||
pickWorkspaceAndOpen(options: INativeOpenDialogOptions): Promise<void> {
|
||||
return this.channel.call('pickWorkspaceAndOpen', options);
|
||||
}
|
||||
|
||||
showMessageBox(windowId: number, options: MessageBoxOptions): TPromise<IMessageBoxResult> {
|
||||
return TPromise.wrap(this.channel.call('showMessageBox', [windowId, options]));
|
||||
showMessageBox(windowId: number, options: MessageBoxOptions): Promise<IMessageBoxResult> {
|
||||
return this.channel.call('showMessageBox', [windowId, options]);
|
||||
}
|
||||
|
||||
showSaveDialog(windowId: number, options: SaveDialogOptions): TPromise<string> {
|
||||
return TPromise.wrap(this.channel.call('showSaveDialog', [windowId, options]));
|
||||
showSaveDialog(windowId: number, options: SaveDialogOptions): Promise<string> {
|
||||
return this.channel.call('showSaveDialog', [windowId, options]);
|
||||
}
|
||||
|
||||
showOpenDialog(windowId: number, options: OpenDialogOptions): TPromise<string[]> {
|
||||
return TPromise.wrap(this.channel.call('showOpenDialog', [windowId, options]));
|
||||
showOpenDialog(windowId: number, options: OpenDialogOptions): Promise<string[]> {
|
||||
return this.channel.call('showOpenDialog', [windowId, options]);
|
||||
}
|
||||
|
||||
reloadWindow(windowId: number, args?: ParsedArgs): TPromise<void> {
|
||||
return TPromise.wrap(this.channel.call('reloadWindow', [windowId, args]));
|
||||
reloadWindow(windowId: number, args?: ParsedArgs): Promise<void> {
|
||||
return this.channel.call('reloadWindow', [windowId, args]);
|
||||
}
|
||||
|
||||
openDevTools(windowId: number, options?: IDevToolsOptions): TPromise<void> {
|
||||
return TPromise.wrap(this.channel.call('openDevTools', [windowId, options]));
|
||||
openDevTools(windowId: number, options?: IDevToolsOptions): Promise<void> {
|
||||
return this.channel.call('openDevTools', [windowId, options]);
|
||||
}
|
||||
|
||||
toggleDevTools(windowId: number): TPromise<void> {
|
||||
return TPromise.wrap(this.channel.call('toggleDevTools', windowId));
|
||||
toggleDevTools(windowId: number): Promise<void> {
|
||||
return this.channel.call('toggleDevTools', windowId);
|
||||
}
|
||||
|
||||
closeWorkspace(windowId: number): TPromise<void> {
|
||||
return TPromise.wrap(this.channel.call('closeWorkspace', windowId));
|
||||
closeWorkspace(windowId: number): Promise<void> {
|
||||
return this.channel.call('closeWorkspace', windowId);
|
||||
}
|
||||
|
||||
enterWorkspace(windowId: number, path: string): TPromise<IEnterWorkspaceResult> {
|
||||
return TPromise.wrap(this.channel.call('enterWorkspace', [windowId, path]));
|
||||
enterWorkspace(windowId: number, path: URI): Promise<IEnterWorkspaceResult> {
|
||||
return this.channel.call('enterWorkspace', [windowId, path]);
|
||||
}
|
||||
|
||||
createAndEnterWorkspace(windowId: number, folders?: IWorkspaceFolderCreationData[], path?: string): TPromise<IEnterWorkspaceResult> {
|
||||
return TPromise.wrap(this.channel.call('createAndEnterWorkspace', [windowId, folders, path]));
|
||||
toggleFullScreen(windowId: number): Promise<void> {
|
||||
return this.channel.call('toggleFullScreen', windowId);
|
||||
}
|
||||
|
||||
saveAndEnterWorkspace(windowId: number, path: string): TPromise<IEnterWorkspaceResult> {
|
||||
return TPromise.wrap(this.channel.call('saveAndEnterWorkspace', [windowId, path]));
|
||||
setRepresentedFilename(windowId: number, fileName: string): Promise<void> {
|
||||
return this.channel.call('setRepresentedFilename', [windowId, fileName]);
|
||||
}
|
||||
|
||||
toggleFullScreen(windowId: number): TPromise<void> {
|
||||
return TPromise.wrap(this.channel.call('toggleFullScreen', windowId));
|
||||
addRecentlyOpened(files: URI[]): Promise<void> {
|
||||
return this.channel.call('addRecentlyOpened', files);
|
||||
}
|
||||
|
||||
setRepresentedFilename(windowId: number, fileName: string): TPromise<void> {
|
||||
return TPromise.wrap(this.channel.call('setRepresentedFilename', [windowId, fileName]));
|
||||
removeFromRecentlyOpened(paths: Array<IWorkspaceIdentifier | ISingleFolderWorkspaceIdentifier | URI>): Promise<void> {
|
||||
return this.channel.call('removeFromRecentlyOpened', paths);
|
||||
}
|
||||
|
||||
addRecentlyOpened(files: URI[]): TPromise<void> {
|
||||
return TPromise.wrap(this.channel.call('addRecentlyOpened', files));
|
||||
clearRecentlyOpened(): Promise<void> {
|
||||
return this.channel.call('clearRecentlyOpened');
|
||||
}
|
||||
|
||||
removeFromRecentlyOpened(paths: (IWorkspaceIdentifier | ISingleFolderWorkspaceIdentifier | URI)[]): TPromise<void> {
|
||||
return TPromise.wrap(this.channel.call('removeFromRecentlyOpened', paths));
|
||||
}
|
||||
|
||||
clearRecentlyOpened(): TPromise<void> {
|
||||
return TPromise.wrap(this.channel.call('clearRecentlyOpened'));
|
||||
}
|
||||
|
||||
getRecentlyOpened(windowId: number): TPromise<IRecentlyOpened> {
|
||||
return TPromise.wrap<IRecentlyOpened>(this.channel.call('getRecentlyOpened', windowId))
|
||||
.then(recentlyOpened => {
|
||||
getRecentlyOpened(windowId: number): Promise<IRecentlyOpened> {
|
||||
return this.channel.call('getRecentlyOpened', windowId)
|
||||
.then((recentlyOpened: IRecentlyOpened) => {
|
||||
recentlyOpened.workspaces = recentlyOpened.workspaces.map(workspace => isWorkspaceIdentifier(workspace) ? workspace : URI.revive(workspace));
|
||||
recentlyOpened.files = recentlyOpened.files.map(URI.revive);
|
||||
return recentlyOpened;
|
||||
});
|
||||
}
|
||||
|
||||
newWindowTab(): TPromise<void> {
|
||||
return TPromise.wrap(this.channel.call('newWindowTab'));
|
||||
newWindowTab(): Promise<void> {
|
||||
return this.channel.call('newWindowTab');
|
||||
}
|
||||
|
||||
showPreviousWindowTab(): TPromise<void> {
|
||||
return TPromise.wrap(this.channel.call('showPreviousWindowTab'));
|
||||
showPreviousWindowTab(): Promise<void> {
|
||||
return this.channel.call('showPreviousWindowTab');
|
||||
}
|
||||
|
||||
showNextWindowTab(): TPromise<void> {
|
||||
return TPromise.wrap(this.channel.call('showNextWindowTab'));
|
||||
showNextWindowTab(): Promise<void> {
|
||||
return this.channel.call('showNextWindowTab');
|
||||
}
|
||||
|
||||
moveWindowTabToNewWindow(): TPromise<void> {
|
||||
return TPromise.wrap(this.channel.call('moveWindowTabToNewWindow'));
|
||||
moveWindowTabToNewWindow(): Promise<void> {
|
||||
return this.channel.call('moveWindowTabToNewWindow');
|
||||
}
|
||||
|
||||
mergeAllWindowTabs(): TPromise<void> {
|
||||
return TPromise.wrap(this.channel.call('mergeAllWindowTabs'));
|
||||
mergeAllWindowTabs(): Promise<void> {
|
||||
return this.channel.call('mergeAllWindowTabs');
|
||||
}
|
||||
|
||||
toggleWindowTabsBar(): TPromise<void> {
|
||||
return TPromise.wrap(this.channel.call('toggleWindowTabsBar'));
|
||||
toggleWindowTabsBar(): Promise<void> {
|
||||
return this.channel.call('toggleWindowTabsBar');
|
||||
}
|
||||
|
||||
focusWindow(windowId: number): TPromise<void> {
|
||||
return TPromise.wrap(this.channel.call('focusWindow', windowId));
|
||||
focusWindow(windowId: number): Promise<void> {
|
||||
return this.channel.call('focusWindow', windowId);
|
||||
}
|
||||
|
||||
closeWindow(windowId: number): TPromise<void> {
|
||||
return TPromise.wrap(this.channel.call('closeWindow', windowId));
|
||||
closeWindow(windowId: number): Promise<void> {
|
||||
return this.channel.call('closeWindow', windowId);
|
||||
}
|
||||
|
||||
isFocused(windowId: number): TPromise<boolean> {
|
||||
return TPromise.wrap(this.channel.call('isFocused', windowId));
|
||||
isFocused(windowId: number): Promise<boolean> {
|
||||
return this.channel.call('isFocused', windowId);
|
||||
}
|
||||
|
||||
isMaximized(windowId: number): TPromise<boolean> {
|
||||
return TPromise.wrap(this.channel.call('isMaximized', windowId));
|
||||
isMaximized(windowId: number): Promise<boolean> {
|
||||
return this.channel.call('isMaximized', windowId);
|
||||
}
|
||||
|
||||
maximizeWindow(windowId: number): TPromise<void> {
|
||||
return TPromise.wrap(this.channel.call('maximizeWindow', windowId));
|
||||
maximizeWindow(windowId: number): Promise<void> {
|
||||
return this.channel.call('maximizeWindow', windowId);
|
||||
}
|
||||
|
||||
unmaximizeWindow(windowId: number): TPromise<void> {
|
||||
return TPromise.wrap(this.channel.call('unmaximizeWindow', windowId));
|
||||
unmaximizeWindow(windowId: number): Promise<void> {
|
||||
return this.channel.call('unmaximizeWindow', windowId);
|
||||
}
|
||||
|
||||
minimizeWindow(windowId: number): TPromise<void> {
|
||||
return TPromise.wrap(this.channel.call('minimizeWindow', windowId));
|
||||
minimizeWindow(windowId: number): Promise<void> {
|
||||
return this.channel.call('minimizeWindow', windowId);
|
||||
}
|
||||
|
||||
onWindowTitleDoubleClick(windowId: number): TPromise<void> {
|
||||
return TPromise.wrap(this.channel.call('onWindowTitleDoubleClick', windowId));
|
||||
onWindowTitleDoubleClick(windowId: number): Promise<void> {
|
||||
return this.channel.call('onWindowTitleDoubleClick', windowId);
|
||||
}
|
||||
|
||||
setDocumentEdited(windowId: number, flag: boolean): TPromise<void> {
|
||||
return TPromise.wrap(this.channel.call('setDocumentEdited', [windowId, flag]));
|
||||
setDocumentEdited(windowId: number, flag: boolean): Promise<void> {
|
||||
return this.channel.call('setDocumentEdited', [windowId, flag]);
|
||||
}
|
||||
|
||||
quit(): TPromise<void> {
|
||||
return TPromise.wrap(this.channel.call('quit'));
|
||||
quit(): Promise<void> {
|
||||
return this.channel.call('quit');
|
||||
}
|
||||
|
||||
relaunch(options: { addArgs?: string[], removeArgs?: string[] }): TPromise<void> {
|
||||
return TPromise.wrap(this.channel.call('relaunch', [options]));
|
||||
relaunch(options: { addArgs?: string[], removeArgs?: string[] }): Promise<void> {
|
||||
return this.channel.call('relaunch', [options]);
|
||||
}
|
||||
|
||||
whenSharedProcessReady(): TPromise<void> {
|
||||
return TPromise.wrap(this.channel.call('whenSharedProcessReady'));
|
||||
whenSharedProcessReady(): Promise<void> {
|
||||
return this.channel.call('whenSharedProcessReady');
|
||||
}
|
||||
|
||||
toggleSharedProcess(): TPromise<void> {
|
||||
return TPromise.wrap(this.channel.call('toggleSharedProcess'));
|
||||
toggleSharedProcess(): Promise<void> {
|
||||
return this.channel.call('toggleSharedProcess');
|
||||
}
|
||||
|
||||
openWindow(windowId: number, paths: URI[], options?: { forceNewWindow?: boolean, forceReuseWindow?: boolean, forceOpenWorkspaceAsFile?: boolean, args?: ParsedArgs }): TPromise<void> {
|
||||
return TPromise.wrap(this.channel.call('openWindow', [windowId, paths, options]));
|
||||
openWindow(windowId: number, paths: URI[], options?: { forceNewWindow?: boolean, forceReuseWindow?: boolean, forceOpenWorkspaceAsFile?: boolean, args?: ParsedArgs }): Promise<void> {
|
||||
return this.channel.call('openWindow', [windowId, paths, options]);
|
||||
}
|
||||
|
||||
openNewWindow(options?: INewWindowOptions): TPromise<void> {
|
||||
openNewWindow(options?: INewWindowOptions): Promise<void> {
|
||||
return this.channel.call('openNewWindow', options);
|
||||
}
|
||||
|
||||
showWindow(windowId: number): TPromise<void> {
|
||||
return TPromise.wrap(this.channel.call('showWindow', windowId));
|
||||
showWindow(windowId: number): Promise<void> {
|
||||
return this.channel.call('showWindow', windowId);
|
||||
}
|
||||
|
||||
getWindows(): TPromise<{ id: number; workspace?: IWorkspaceIdentifier; folderUri?: ISingleFolderWorkspaceIdentifier; title: string; filename?: string; }[]> {
|
||||
return TPromise.wrap(this.channel.call<{ id: number; workspace?: IWorkspaceIdentifier; folderUri?: ISingleFolderWorkspaceIdentifier; title: string; filename?: string; }[]>('getWindows').then(result => { result.forEach(win => win.folderUri = win.folderUri ? URI.revive(win.folderUri) : win.folderUri); return result; }));
|
||||
getWindows(): Promise<{ id: number; workspace?: IWorkspaceIdentifier; folderUri?: ISingleFolderWorkspaceIdentifier; title: string; filename?: string; }[]> {
|
||||
return this.channel.call<{ id: number; workspace?: IWorkspaceIdentifier; folderUri?: ISingleFolderWorkspaceIdentifier; title: string; filename?: string; }[]>('getWindows').then(result => { result.forEach(win => win.folderUri = win.folderUri ? URI.revive(win.folderUri) : win.folderUri); return result; });
|
||||
}
|
||||
|
||||
getWindowCount(): TPromise<number> {
|
||||
return TPromise.wrap(this.channel.call('getWindowCount'));
|
||||
getWindowCount(): Promise<number> {
|
||||
return this.channel.call('getWindowCount');
|
||||
}
|
||||
|
||||
log(severity: string, ...messages: string[]): TPromise<void> {
|
||||
return TPromise.wrap(this.channel.call('log', [severity, messages]));
|
||||
log(severity: string, ...messages: string[]): Promise<void> {
|
||||
return this.channel.call('log', [severity, messages]);
|
||||
}
|
||||
|
||||
showItemInFolder(path: string): TPromise<void> {
|
||||
return TPromise.wrap(this.channel.call('showItemInFolder', path));
|
||||
showItemInFolder(path: string): Promise<void> {
|
||||
return this.channel.call('showItemInFolder', path);
|
||||
}
|
||||
|
||||
getActiveWindowId(): TPromise<number | undefined> {
|
||||
return TPromise.wrap(this.channel.call('getActiveWindowId'));
|
||||
getActiveWindowId(): Promise<number | undefined> {
|
||||
return this.channel.call('getActiveWindowId');
|
||||
}
|
||||
|
||||
openExternal(url: string): TPromise<boolean> {
|
||||
return TPromise.wrap(this.channel.call('openExternal', url));
|
||||
openExternal(url: string): Promise<boolean> {
|
||||
return this.channel.call('openExternal', url);
|
||||
}
|
||||
|
||||
startCrashReporter(config: CrashReporterStartOptions): TPromise<void> {
|
||||
return TPromise.wrap(this.channel.call('startCrashReporter', config));
|
||||
startCrashReporter(config: CrashReporterStartOptions): Promise<void> {
|
||||
return this.channel.call('startCrashReporter', config);
|
||||
}
|
||||
|
||||
updateTouchBar(windowId: number, items: ISerializableCommandAction[][]): TPromise<void> {
|
||||
return TPromise.wrap(this.channel.call('updateTouchBar', [windowId, items]));
|
||||
updateTouchBar(windowId: number, items: ISerializableCommandAction[][]): Promise<void> {
|
||||
return this.channel.call('updateTouchBar', [windowId, items]);
|
||||
}
|
||||
|
||||
openAboutDialog(): TPromise<void> {
|
||||
return TPromise.wrap(this.channel.call('openAboutDialog'));
|
||||
openAboutDialog(): Promise<void> {
|
||||
return this.channel.call('openAboutDialog');
|
||||
}
|
||||
|
||||
resolveProxy(windowId: number, url: string): Promise<string | undefined> {
|
||||
|
||||
Reference in New Issue
Block a user