Merge from vscode 966b87dd4013be1a9c06e2b8334522ec61905cc2 (#4696)

This commit is contained in:
Anthony Dresser
2019-03-26 11:43:38 -07:00
committed by GitHub
parent b1393ae615
commit 0d8ef9583b
268 changed files with 5947 additions and 3422 deletions

View File

@@ -84,6 +84,7 @@ export interface SaveDialogOptions {
export interface INewWindowOptions {
remoteAuthority?: string;
reuseWindow?: boolean;
}
export interface IDevToolsOptions {
@@ -149,9 +150,8 @@ export interface IWindowsService {
toggleSharedProcess(): Promise<void>;
// Global methods
openWindow(windowId: number, uris: IURIToOpen[], options?: IOpenSettings): Promise<void>;
openWindow(windowId: number, uris: IURIToOpen[], options: IOpenSettings): Promise<void>;
openNewWindow(options?: INewWindowOptions): Promise<void>;
showWindow(windowId: number): Promise<void>;
getWindows(): Promise<{ id: number; workspace?: IWorkspaceIdentifier; folderUri?: ISingleFolderWorkspaceIdentifier; title: string; filename?: string; }[]>;
getWindowCount(): Promise<number>;
log(severity: string, ...messages: string[]): Promise<void>;
@@ -183,6 +183,7 @@ export interface IOpenSettings {
diffMode?: boolean;
addMode?: boolean;
noRecentEntry?: boolean;
waitMarkerFileURI?: URI;
args?: ParsedArgs;
}
@@ -228,7 +229,6 @@ export interface IWindowService {
unmaximizeWindow(): Promise<void>;
minimizeWindow(): Promise<void>;
onWindowTitleDoubleClick(): Promise<void>;
show(): Promise<void>;
showMessageBox(options: MessageBoxOptions): Promise<IMessageBoxResult>;
showSaveDialog(options: SaveDialogOptions): Promise<string>;
showOpenDialog(options: OpenDialogOptions): Promise<string[]>;

View File

@@ -98,7 +98,7 @@ export class WindowService extends Disposable implements IWindowService {
return this.windowsService.enterWorkspace(this.windowId, path);
}
openWindow(uris: IURIToOpen[], options?: IOpenSettings): Promise<void> {
openWindow(uris: IURIToOpen[], options: IOpenSettings = {}): Promise<void> {
if (!!this.configuration.remoteAuthority) {
uris.forEach(u => u.label = u.label || this.getRecentLabel(u, !!(options && options.forceOpenWorkspaceAsFile)));
}
@@ -153,10 +153,6 @@ export class WindowService extends Disposable implements IWindowService {
return this.windowsService.setDocumentEdited(this.windowId, flag);
}
show(): Promise<void> {
return this.windowsService.showWindow(this.windowId);
}
showMessageBox(options: Electron.MessageBoxOptions): Promise<IMessageBoxResult> {
return this.windowsService.showMessageBox(this.windowId, options);
}

View File

@@ -5,7 +5,7 @@
import { Event } from 'vs/base/common/event';
import { IChannel } from 'vs/base/parts/ipc/common/ipc';
import { IWindowsService, INativeOpenDialogOptions, IEnterWorkspaceResult, CrashReporterStartOptions, IMessageBoxResult, MessageBoxOptions, SaveDialogOptions, OpenDialogOptions, IDevToolsOptions, INewWindowOptions, IURIToOpen } from 'vs/platform/windows/common/windows';
import { IWindowsService, INativeOpenDialogOptions, IEnterWorkspaceResult, CrashReporterStartOptions, IMessageBoxResult, MessageBoxOptions, SaveDialogOptions, OpenDialogOptions, IDevToolsOptions, INewWindowOptions, IURIToOpen, IOpenSettings } from 'vs/platform/windows/common/windows';
import { IWorkspaceIdentifier, ISingleFolderWorkspaceIdentifier, reviveWorkspaceIdentifier } from 'vs/platform/workspaces/common/workspaces';
import { IRecentlyOpened, IRecent, isRecentWorkspace } from 'vs/platform/history/common/history';
import { ISerializableCommandAction } from 'vs/platform/actions/common/actions';
@@ -186,7 +186,7 @@ export class WindowsService implements IWindowsService {
return this.channel.call('toggleSharedProcess');
}
openWindow(windowId: number, uris: IURIToOpen[], options?: { forceNewWindow?: boolean, forceReuseWindow?: boolean, forceOpenWorkspaceAsFile?: boolean, args?: ParsedArgs }): Promise<void> {
openWindow(windowId: number, uris: IURIToOpen[], options: IOpenSettings): Promise<void> {
return this.channel.call('openWindow', [windowId, uris, options]);
}
@@ -194,10 +194,6 @@ export class WindowsService implements IWindowsService {
return this.channel.call('openNewWindow', options);
}
showWindow(windowId: number): Promise<void> {
return this.channel.call('showWindow', windowId);
}
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 => {
for (const win of result) {

View File

@@ -125,6 +125,7 @@ export interface IOpenConfiguration {
readonly cli: ParsedArgs;
readonly userEnv?: IProcessEnvironment;
readonly urisToOpen?: IURIToOpen[];
readonly waitMarkerFileURI?: URI;
readonly preferNewWindow?: boolean;
readonly forceNewWindow?: boolean;
readonly forceNewTabbedWindow?: boolean;

View File

@@ -218,7 +218,11 @@ export class WindowsService implements IWindowsService, IURLHandler, IDisposable
async focusWindow(windowId: number): Promise<void> {
this.logService.trace('windowsService#focusWindow', windowId);
return this.withWindow(windowId, codeWindow => codeWindow.win.focus());
if (isMacintosh) {
return this.withWindow(windowId, codeWindow => codeWindow.win.show());
} else {
return this.withWindow(windowId, codeWindow => codeWindow.win.focus());
}
}
async closeWindow(windowId: number): Promise<void> {
@@ -273,7 +277,7 @@ export class WindowsService implements IWindowsService, IURLHandler, IDisposable
});
}
async openWindow(windowId: number, urisToOpen: IURIToOpen[], options: IOpenSettings = {}): Promise<void> {
async openWindow(windowId: number, urisToOpen: IURIToOpen[], options: IOpenSettings): Promise<void> {
this.logService.trace('windowsService#openWindow');
if (!urisToOpen || !urisToOpen.length) {
return undefined;
@@ -289,7 +293,8 @@ export class WindowsService implements IWindowsService, IURLHandler, IDisposable
forceOpenWorkspaceAsFile: options.forceOpenWorkspaceAsFile,
diffMode: options.diffMode,
addMode: options.addMode,
noRecentEntry: options.noRecentEntry
noRecentEntry: options.noRecentEntry,
waitMarkerFileURI: options.waitMarkerFileURI
});
}
@@ -299,12 +304,6 @@ export class WindowsService implements IWindowsService, IURLHandler, IDisposable
this.windowsMainService.openNewWindow(OpenContext.API, options);
}
async showWindow(windowId: number): Promise<void> {
this.logService.trace('windowsService#showWindow', windowId);
return this.withWindow(windowId, codeWindow => codeWindow.win.show());
}
async getWindows(): Promise<{ id: number; workspace?: IWorkspaceIdentifier; folderUri?: ISingleFolderWorkspaceIdentifier; title: string; filename?: string; }[]> {
this.logService.trace('windowsService#getWindows');
@@ -466,4 +465,4 @@ export class WindowsService implements IWindowsService, IURLHandler, IDisposable
dispose(): void {
this.disposables = dispose(this.disposables);
}
}
}

View File

@@ -5,7 +5,7 @@
import { Event } from 'vs/base/common/event';
import { IServerChannel } from 'vs/base/parts/ipc/common/ipc';
import { IWindowsService, IURIToOpen } from 'vs/platform/windows/common/windows';
import { IWindowsService, IURIToOpen, IOpenSettings } from 'vs/platform/windows/common/windows';
import { reviveWorkspaceIdentifier } from 'vs/platform/workspaces/common/workspaces';
import { URI } from 'vs/base/common/uri';
import { IRecent, isRecentFile, isRecentFolder } from 'vs/platform/history/common/history';
@@ -86,9 +86,14 @@ export class WindowsChannel implements IServerChannel {
case 'minimizeWindow': return this.service.minimizeWindow(arg);
case 'onWindowTitleDoubleClick': return this.service.onWindowTitleDoubleClick(arg);
case 'setDocumentEdited': return this.service.setDocumentEdited(arg[0], arg[1]);
case 'openWindow': return this.service.openWindow(arg[0], arg[1] ? (<IURIToOpen[]>arg[1]).map(r => { r.uri = URI.revive(r.uri); return r; }) : arg[1], arg[2]);
case 'openWindow': {
const urisToOpen: IURIToOpen[] = arg[1];
const options: IOpenSettings = arg[2];
urisToOpen.forEach(r => { r.uri = URI.revive(r.uri); return r; });
options.waitMarkerFileURI = options.waitMarkerFileURI && URI.revive(options.waitMarkerFileURI);
return this.service.openWindow(arg[0], urisToOpen, options);
}
case 'openNewWindow': return this.service.openNewWindow(arg);
case 'showWindow': return this.service.showWindow(arg);
case 'getWindows': return this.service.getWindows();
case 'getWindowCount': return this.service.getWindowCount();
case 'relaunch': return this.service.relaunch(arg[0]);