mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 18:46:40 -05:00
Vscode merge (#4582)
* Merge from vscode 37cb23d3dd4f9433d56d4ba5ea3203580719a0bd * fix issues with merges * bump node version in azpipe * replace license headers * remove duplicate launch task * fix build errors * fix build errors * fix tslint issues * working through package and linux build issues * more work * wip * fix packaged builds * working through linux build errors * wip * wip * wip * fix mac and linux file limits * iterate linux pipeline * disable editor typing * revert series to parallel * remove optimize vscode from linux * fix linting issues * revert testing change * add work round for new node * readd packaging for extensions * fix issue with angular not resolving decorator dependencies
This commit is contained in:
@@ -6,10 +6,10 @@
|
||||
import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { Event } from 'vs/base/common/event';
|
||||
import { ITelemetryData } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { IProcessEnvironment, isMacintosh } from 'vs/base/common/platform';
|
||||
import { IProcessEnvironment, isMacintosh, isLinux } from 'vs/base/common/platform';
|
||||
import { ParsedArgs, IEnvironmentService } from 'vs/platform/environment/common/environment';
|
||||
import { IWorkspaceIdentifier, ISingleFolderWorkspaceIdentifier } from 'vs/platform/workspaces/common/workspaces';
|
||||
import { IRecentlyOpened } from 'vs/platform/history/common/history';
|
||||
import { IRecentlyOpened, IRecent } from 'vs/platform/history/common/history';
|
||||
import { ISerializableCommandAction } from 'vs/platform/actions/common/actions';
|
||||
import { ExportData } from 'vs/base/common/performance';
|
||||
import { LogLevel } from 'vs/platform/log/common/log';
|
||||
@@ -31,7 +31,7 @@ export interface INativeOpenDialogOptions {
|
||||
|
||||
export interface IEnterWorkspaceResult {
|
||||
workspace: IWorkspaceIdentifier;
|
||||
backupPath: string;
|
||||
backupPath?: string;
|
||||
}
|
||||
|
||||
export interface CrashReporterStartOptions {
|
||||
@@ -117,8 +117,8 @@ export interface IWindowsService {
|
||||
enterWorkspace(windowId: number, path: URI): Promise<IEnterWorkspaceResult | undefined>;
|
||||
toggleFullScreen(windowId: number): Promise<void>;
|
||||
setRepresentedFilename(windowId: number, fileName: string): Promise<void>;
|
||||
addRecentlyOpened(files: URI[]): Promise<void>;
|
||||
removeFromRecentlyOpened(paths: Array<IWorkspaceIdentifier | ISingleFolderWorkspaceIdentifier | URI | string>): Promise<void>;
|
||||
addRecentlyOpened(recents: IRecent[]): Promise<void>;
|
||||
removeFromRecentlyOpened(paths: URI[]): Promise<void>;
|
||||
clearRecentlyOpened(): Promise<void>;
|
||||
getRecentlyOpened(windowId: number): Promise<IRecentlyOpened>;
|
||||
focusWindow(windowId: number): Promise<void>;
|
||||
@@ -149,13 +149,13 @@ export interface IWindowsService {
|
||||
toggleSharedProcess(): Promise<void>;
|
||||
|
||||
// Global methods
|
||||
openWindow(windowId: number, paths: URI[], 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>;
|
||||
showItemInFolder(path: string): Promise<void>;
|
||||
showItemInFolder(path: URI): Promise<void>;
|
||||
getActiveWindowId(): Promise<number | undefined>;
|
||||
|
||||
// This needs to be handled from browser process to prevent
|
||||
@@ -185,6 +185,14 @@ export interface IOpenSettings {
|
||||
args?: ParsedArgs;
|
||||
}
|
||||
|
||||
export type URIType = 'file' | 'folder';
|
||||
|
||||
export interface IURIToOpen {
|
||||
uri: URI;
|
||||
typeHint?: URIType;
|
||||
label?: string;
|
||||
}
|
||||
|
||||
export interface IWindowService {
|
||||
|
||||
_serviceBrand: any;
|
||||
@@ -211,7 +219,7 @@ export interface IWindowService {
|
||||
getRecentlyOpened(): Promise<IRecentlyOpened>;
|
||||
focusWindow(): Promise<void>;
|
||||
closeWindow(): Promise<void>;
|
||||
openWindow(paths: URI[], options?: IOpenSettings): Promise<void>;
|
||||
openWindow(uris: IURIToOpen[], options?: IOpenSettings): Promise<void>;
|
||||
isFocused(): Promise<boolean>;
|
||||
setDocumentEdited(flag: boolean): Promise<void>;
|
||||
isMaximized(): Promise<boolean>;
|
||||
@@ -270,14 +278,14 @@ export function getTitleBarStyle(configurationService: IConfigurationService, en
|
||||
}
|
||||
|
||||
const style = configuration.titleBarStyle;
|
||||
if (style === 'native') {
|
||||
return 'native';
|
||||
if (style === 'native' || style === 'custom') {
|
||||
return style;
|
||||
}
|
||||
}
|
||||
|
||||
// {{SQL CARBON EDIT}} - Always use native toolbar
|
||||
return 'native';
|
||||
// return 'custom'; // default to custom on all OS
|
||||
// return isLinux ? 'native' : 'custom'; // default to custom on all macOS and Windows
|
||||
}
|
||||
|
||||
export const enum OpenContext {
|
||||
@@ -375,7 +383,7 @@ export interface IWindowConfiguration extends ParsedArgs {
|
||||
isInitialStartup?: boolean;
|
||||
|
||||
userEnv: IProcessEnvironment;
|
||||
nodeCachedDataDir: string;
|
||||
nodeCachedDataDir?: string;
|
||||
|
||||
backupPath?: string;
|
||||
|
||||
@@ -390,7 +398,7 @@ export interface IWindowConfiguration extends ParsedArgs {
|
||||
highContrast?: boolean;
|
||||
frameless?: boolean;
|
||||
accessibilitySupport?: boolean;
|
||||
partsSplashData?: string;
|
||||
partsSplashPath?: string;
|
||||
|
||||
perfStartTime?: number;
|
||||
perfAppReady?: number;
|
||||
|
||||
@@ -4,12 +4,14 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { Event } from 'vs/base/common/event';
|
||||
import { IWindowService, IWindowsService, INativeOpenDialogOptions, IEnterWorkspaceResult, IMessageBoxResult, IWindowConfiguration, IDevToolsOptions, IOpenSettings } from 'vs/platform/windows/common/windows';
|
||||
import { IWindowService, IWindowsService, INativeOpenDialogOptions, IEnterWorkspaceResult, IMessageBoxResult, IWindowConfiguration, IDevToolsOptions, IOpenSettings, IURIToOpen } from 'vs/platform/windows/common/windows';
|
||||
import { IRecentlyOpened } from 'vs/platform/history/common/history';
|
||||
import { ISerializableCommandAction } from 'vs/platform/actions/common/actions';
|
||||
import { ParsedArgs } from 'vs/platform/environment/common/environment';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { Disposable } from 'vs/base/common/lifecycle';
|
||||
import { hasWorkspaceFileExtension } from 'vs/platform/workspaces/common/workspaces';
|
||||
import { ILabelService } from 'vs/platform/label/common/label';
|
||||
|
||||
export class WindowService extends Disposable implements IWindowService {
|
||||
|
||||
@@ -18,20 +20,24 @@ export class WindowService extends Disposable implements IWindowService {
|
||||
|
||||
_serviceBrand: any;
|
||||
|
||||
private windowId: number;
|
||||
|
||||
private _hasFocus: boolean;
|
||||
get hasFocus(): boolean { return this._hasFocus; }
|
||||
|
||||
constructor(
|
||||
private windowId: number,
|
||||
private configuration: IWindowConfiguration,
|
||||
@IWindowsService private readonly windowsService: IWindowsService
|
||||
@IWindowsService private readonly windowsService: IWindowsService,
|
||||
@ILabelService private readonly labelService: ILabelService
|
||||
) {
|
||||
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.windowId = configuration.windowId;
|
||||
|
||||
const onThisWindowFocus = Event.map(Event.filter(windowsService.onWindowFocus, id => id === this.windowId), _ => true);
|
||||
const onThisWindowBlur = Event.map(Event.filter(windowsService.onWindowBlur, id => id === this.windowId), _ => false);
|
||||
const onThisWindowMaximize = Event.map(Event.filter(windowsService.onWindowMaximize, id => id === this.windowId), _ => true);
|
||||
const onThisWindowUnmaximize = Event.map(Event.filter(windowsService.onWindowUnmaximize, id => id === this.windowId), _ => false);
|
||||
this.onDidChangeFocus = Event.any(onThisWindowFocus, onThisWindowBlur);
|
||||
this.onDidChangeMaximize = Event.any(onThisWindowMaximize, onThisWindowUnmaximize);
|
||||
|
||||
@@ -92,8 +98,11 @@ export class WindowService extends Disposable implements IWindowService {
|
||||
return this.windowsService.enterWorkspace(this.windowId, path);
|
||||
}
|
||||
|
||||
openWindow(paths: URI[], options?: IOpenSettings): Promise<void> {
|
||||
return this.windowsService.openWindow(this.windowId, paths, options);
|
||||
openWindow(uris: IURIToOpen[], options?: IOpenSettings): Promise<void> {
|
||||
if (!!this.configuration.remoteAuthority) {
|
||||
uris.forEach(u => u.label = u.label || this.getRecentLabel(u, !!(options && options.forceOpenWorkspaceAsFile)));
|
||||
}
|
||||
return this.windowsService.openWindow(this.windowId, uris, options);
|
||||
}
|
||||
|
||||
closeWindow(): Promise<void> {
|
||||
@@ -167,4 +176,15 @@ export class WindowService extends Disposable implements IWindowService {
|
||||
resolveProxy(url: string): Promise<string | undefined> {
|
||||
return this.windowsService.resolveProxy(this.windowId, url);
|
||||
}
|
||||
|
||||
private getRecentLabel(u: IURIToOpen, forceOpenWorkspaceAsFile: boolean): string {
|
||||
if (u.typeHint === 'folder') {
|
||||
return this.labelService.getWorkspaceLabel(u.uri, { verbose: true });
|
||||
} else if (!forceOpenWorkspaceAsFile && hasWorkspaceFileExtension(u.uri.path)) {
|
||||
return this.labelService.getWorkspaceLabel({ id: '', configPath: u.uri }, { verbose: true });
|
||||
} else {
|
||||
return this.labelService.getUriLabel(u.uri);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
250
src/vs/platform/windows/electron-browser/windowsService.ts
Normal file
250
src/vs/platform/windows/electron-browser/windowsService.ts
Normal file
@@ -0,0 +1,250 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
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 { 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';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { ParsedArgs } from 'vs/platform/environment/common/environment';
|
||||
import { IMainProcessService } from 'vs/platform/ipc/electron-browser/mainProcessService';
|
||||
|
||||
export class WindowsService implements IWindowsService {
|
||||
|
||||
_serviceBrand: any;
|
||||
|
||||
private channel: IChannel;
|
||||
|
||||
constructor(@IMainProcessService mainProcessService: IMainProcessService) {
|
||||
this.channel = mainProcessService.getChannel('windows');
|
||||
}
|
||||
|
||||
get onWindowOpen(): Event<number> { return this.channel.listen('onWindowOpen'); }
|
||||
get onWindowFocus(): Event<number> { return this.channel.listen('onWindowFocus'); }
|
||||
get onWindowBlur(): Event<number> { return this.channel.listen('onWindowBlur'); }
|
||||
get onWindowMaximize(): Event<number> { return this.channel.listen('onWindowMaximize'); }
|
||||
get onWindowUnmaximize(): Event<number> { return this.channel.listen('onWindowUnmaximize'); }
|
||||
get onRecentlyOpenedChange(): Event<void> { return this.channel.listen('onRecentlyOpenedChange'); }
|
||||
|
||||
pickFileFolderAndOpen(options: INativeOpenDialogOptions): Promise<void> {
|
||||
return this.channel.call('pickFileFolderAndOpen', options);
|
||||
}
|
||||
|
||||
pickFileAndOpen(options: INativeOpenDialogOptions): Promise<void> {
|
||||
return this.channel.call('pickFileAndOpen', options);
|
||||
}
|
||||
|
||||
pickFolderAndOpen(options: INativeOpenDialogOptions): Promise<void> {
|
||||
return this.channel.call('pickFolderAndOpen', options);
|
||||
}
|
||||
|
||||
pickWorkspaceAndOpen(options: INativeOpenDialogOptions): Promise<void> {
|
||||
return this.channel.call('pickWorkspaceAndOpen', options);
|
||||
}
|
||||
|
||||
showMessageBox(windowId: number, options: MessageBoxOptions): Promise<IMessageBoxResult> {
|
||||
return this.channel.call('showMessageBox', [windowId, options]);
|
||||
}
|
||||
|
||||
showSaveDialog(windowId: number, options: SaveDialogOptions): Promise<string> {
|
||||
return this.channel.call('showSaveDialog', [windowId, options]);
|
||||
}
|
||||
|
||||
showOpenDialog(windowId: number, options: OpenDialogOptions): Promise<string[]> {
|
||||
return this.channel.call('showOpenDialog', [windowId, options]);
|
||||
}
|
||||
|
||||
reloadWindow(windowId: number, args?: ParsedArgs): Promise<void> {
|
||||
return this.channel.call('reloadWindow', [windowId, args]);
|
||||
}
|
||||
|
||||
openDevTools(windowId: number, options?: IDevToolsOptions): Promise<void> {
|
||||
return this.channel.call('openDevTools', [windowId, options]);
|
||||
}
|
||||
|
||||
toggleDevTools(windowId: number): Promise<void> {
|
||||
return this.channel.call('toggleDevTools', windowId);
|
||||
}
|
||||
|
||||
closeWorkspace(windowId: number): Promise<void> {
|
||||
return this.channel.call('closeWorkspace', windowId);
|
||||
}
|
||||
|
||||
enterWorkspace(windowId: number, path: URI): Promise<IEnterWorkspaceResult> {
|
||||
return this.channel.call('enterWorkspace', [windowId, path]).then((result: IEnterWorkspaceResult) => {
|
||||
result.workspace = reviveWorkspaceIdentifier(result.workspace);
|
||||
return result;
|
||||
});
|
||||
}
|
||||
|
||||
toggleFullScreen(windowId: number): Promise<void> {
|
||||
return this.channel.call('toggleFullScreen', windowId);
|
||||
}
|
||||
|
||||
setRepresentedFilename(windowId: number, fileName: string): Promise<void> {
|
||||
return this.channel.call('setRepresentedFilename', [windowId, fileName]);
|
||||
}
|
||||
|
||||
addRecentlyOpened(recent: IRecent[]): Promise<void> {
|
||||
return this.channel.call('addRecentlyOpened', recent);
|
||||
}
|
||||
|
||||
removeFromRecentlyOpened(paths: Array<URI>): Promise<void> {
|
||||
return this.channel.call('removeFromRecentlyOpened', paths);
|
||||
}
|
||||
|
||||
clearRecentlyOpened(): Promise<void> {
|
||||
return this.channel.call('clearRecentlyOpened');
|
||||
}
|
||||
|
||||
getRecentlyOpened(windowId: number): Promise<IRecentlyOpened> {
|
||||
return this.channel.call('getRecentlyOpened', windowId)
|
||||
.then((recentlyOpened: IRecentlyOpened) => {
|
||||
recentlyOpened.workspaces.forEach(recent => isRecentWorkspace(recent) ? recent.workspace = reviveWorkspaceIdentifier(recent.workspace) : recent.folderUri = URI.revive(recent.folderUri));
|
||||
recentlyOpened.files.forEach(recent => recent.fileUri = URI.revive(recent.fileUri));
|
||||
return recentlyOpened;
|
||||
});
|
||||
}
|
||||
|
||||
newWindowTab(): Promise<void> {
|
||||
return this.channel.call('newWindowTab');
|
||||
}
|
||||
|
||||
showPreviousWindowTab(): Promise<void> {
|
||||
return this.channel.call('showPreviousWindowTab');
|
||||
}
|
||||
|
||||
showNextWindowTab(): Promise<void> {
|
||||
return this.channel.call('showNextWindowTab');
|
||||
}
|
||||
|
||||
moveWindowTabToNewWindow(): Promise<void> {
|
||||
return this.channel.call('moveWindowTabToNewWindow');
|
||||
}
|
||||
|
||||
mergeAllWindowTabs(): Promise<void> {
|
||||
return this.channel.call('mergeAllWindowTabs');
|
||||
}
|
||||
|
||||
toggleWindowTabsBar(): Promise<void> {
|
||||
return this.channel.call('toggleWindowTabsBar');
|
||||
}
|
||||
|
||||
focusWindow(windowId: number): Promise<void> {
|
||||
return this.channel.call('focusWindow', windowId);
|
||||
}
|
||||
|
||||
closeWindow(windowId: number): Promise<void> {
|
||||
return this.channel.call('closeWindow', windowId);
|
||||
}
|
||||
|
||||
isFocused(windowId: number): Promise<boolean> {
|
||||
return this.channel.call('isFocused', windowId);
|
||||
}
|
||||
|
||||
isMaximized(windowId: number): Promise<boolean> {
|
||||
return this.channel.call('isMaximized', windowId);
|
||||
}
|
||||
|
||||
maximizeWindow(windowId: number): Promise<void> {
|
||||
return this.channel.call('maximizeWindow', windowId);
|
||||
}
|
||||
|
||||
unmaximizeWindow(windowId: number): Promise<void> {
|
||||
return this.channel.call('unmaximizeWindow', windowId);
|
||||
}
|
||||
|
||||
minimizeWindow(windowId: number): Promise<void> {
|
||||
return this.channel.call('minimizeWindow', windowId);
|
||||
}
|
||||
|
||||
onWindowTitleDoubleClick(windowId: number): Promise<void> {
|
||||
return this.channel.call('onWindowTitleDoubleClick', windowId);
|
||||
}
|
||||
|
||||
setDocumentEdited(windowId: number, flag: boolean): Promise<void> {
|
||||
return this.channel.call('setDocumentEdited', [windowId, flag]);
|
||||
}
|
||||
|
||||
quit(): Promise<void> {
|
||||
return this.channel.call('quit');
|
||||
}
|
||||
|
||||
relaunch(options: { addArgs?: string[], removeArgs?: string[] }): Promise<void> {
|
||||
return this.channel.call('relaunch', [options]);
|
||||
}
|
||||
|
||||
whenSharedProcessReady(): Promise<void> {
|
||||
return this.channel.call('whenSharedProcessReady');
|
||||
}
|
||||
|
||||
toggleSharedProcess(): Promise<void> {
|
||||
return this.channel.call('toggleSharedProcess');
|
||||
}
|
||||
|
||||
openWindow(windowId: number, uris: IURIToOpen[], options?: { forceNewWindow?: boolean, forceReuseWindow?: boolean, forceOpenWorkspaceAsFile?: boolean, args?: ParsedArgs }): Promise<void> {
|
||||
return this.channel.call('openWindow', [windowId, uris, options]);
|
||||
}
|
||||
|
||||
openNewWindow(options?: INewWindowOptions): Promise<void> {
|
||||
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) {
|
||||
if (win.folderUri) {
|
||||
win.folderUri = URI.revive(win.folderUri);
|
||||
}
|
||||
if (win.workspace) {
|
||||
win.workspace = reviveWorkspaceIdentifier(win.workspace);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
});
|
||||
}
|
||||
|
||||
getWindowCount(): Promise<number> {
|
||||
return this.channel.call('getWindowCount');
|
||||
}
|
||||
|
||||
log(severity: string, ...messages: string[]): Promise<void> {
|
||||
return this.channel.call('log', [severity, messages]);
|
||||
}
|
||||
|
||||
showItemInFolder(path: URI): Promise<void> {
|
||||
return this.channel.call('showItemInFolder', path);
|
||||
}
|
||||
|
||||
getActiveWindowId(): Promise<number | undefined> {
|
||||
return this.channel.call('getActiveWindowId');
|
||||
}
|
||||
|
||||
openExternal(url: string): Promise<boolean> {
|
||||
return this.channel.call('openExternal', url);
|
||||
}
|
||||
|
||||
startCrashReporter(config: CrashReporterStartOptions): Promise<void> {
|
||||
return this.channel.call('startCrashReporter', config);
|
||||
}
|
||||
|
||||
updateTouchBar(windowId: number, items: ISerializableCommandAction[][]): Promise<void> {
|
||||
return this.channel.call('updateTouchBar', [windowId, items]);
|
||||
}
|
||||
|
||||
openAboutDialog(): Promise<void> {
|
||||
return this.channel.call('openAboutDialog');
|
||||
}
|
||||
|
||||
resolveProxy(windowId: number, url: string): Promise<string | undefined> {
|
||||
return Promise.resolve(this.channel.call('resolveProxy', [windowId, url]));
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,7 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { OpenContext, IWindowConfiguration, INativeOpenDialogOptions, IEnterWorkspaceResult, IMessageBoxResult, INewWindowOptions } from 'vs/platform/windows/common/windows';
|
||||
import { OpenContext, IWindowConfiguration, INativeOpenDialogOptions, IEnterWorkspaceResult, IMessageBoxResult, INewWindowOptions, IURIToOpen } 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';
|
||||
@@ -33,11 +33,11 @@ export interface ICodeWindow {
|
||||
readonly win: Electron.BrowserWindow;
|
||||
readonly config: IWindowConfiguration;
|
||||
|
||||
readonly openedFolderUri: URI;
|
||||
readonly openedWorkspace: IWorkspaceIdentifier;
|
||||
readonly backupPath: string;
|
||||
readonly openedFolderUri?: URI;
|
||||
readonly openedWorkspace?: IWorkspaceIdentifier;
|
||||
readonly backupPath?: string;
|
||||
|
||||
readonly remoteAuthority: string;
|
||||
readonly remoteAuthority?: string;
|
||||
|
||||
readonly isExtensionDevelopmentHost: boolean;
|
||||
readonly isExtensionTestHost: boolean;
|
||||
@@ -94,10 +94,10 @@ export interface IWindowsMainService {
|
||||
// methods
|
||||
ready(initialUserEnv: IProcessEnvironment): void;
|
||||
reload(win: ICodeWindow, cli?: ParsedArgs): void;
|
||||
enterWorkspace(win: ICodeWindow, path: URI): Promise<IEnterWorkspaceResult>;
|
||||
enterWorkspace(win: ICodeWindow, path: URI): Promise<IEnterWorkspaceResult | undefined>;
|
||||
closeWorkspace(win: ICodeWindow): void;
|
||||
open(openConfig: IOpenConfiguration): ICodeWindow[];
|
||||
openExtensionDevelopmentHostWindow(openConfig: IOpenConfiguration): void;
|
||||
openExtensionDevelopmentHostWindow(extensionDevelopmentPath: string, openConfig: IOpenConfiguration): void;
|
||||
pickFileFolderAndOpen(options: INativeOpenDialogOptions): void;
|
||||
pickFolderAndOpen(options: INativeOpenDialogOptions): void;
|
||||
pickFileAndOpen(options: INativeOpenDialogOptions): void;
|
||||
@@ -106,14 +106,14 @@ export interface IWindowsMainService {
|
||||
showSaveDialog(options: Electron.SaveDialogOptions, win?: ICodeWindow): Promise<string>;
|
||||
showOpenDialog(options: Electron.OpenDialogOptions, win?: ICodeWindow): Promise<string[]>;
|
||||
focusLastActive(cli: ParsedArgs, context: OpenContext): ICodeWindow;
|
||||
getLastActiveWindow(): ICodeWindow;
|
||||
getLastActiveWindow(): ICodeWindow | undefined;
|
||||
waitForWindowCloseOrLoad(windowId: number): Promise<void>;
|
||||
openNewWindow(context: OpenContext, options?: INewWindowOptions): ICodeWindow[];
|
||||
openNewTabbedWindow(context: OpenContext): ICodeWindow[];
|
||||
sendToFocused(channel: string, ...args: any[]): void;
|
||||
sendToAll(channel: string, payload: any, windowIdsToIgnore?: number[]): void;
|
||||
getFocusedWindow(): ICodeWindow;
|
||||
getWindowById(windowId: number): ICodeWindow;
|
||||
getFocusedWindow(): ICodeWindow | undefined;
|
||||
getWindowById(windowId: number): ICodeWindow | undefined;
|
||||
getWindows(): ICodeWindow[];
|
||||
getWindowCount(): number;
|
||||
quit(): void;
|
||||
@@ -124,7 +124,7 @@ export interface IOpenConfiguration {
|
||||
readonly contextWindowId?: number;
|
||||
readonly cli: ParsedArgs;
|
||||
readonly userEnv?: IProcessEnvironment;
|
||||
readonly urisToOpen?: URI[];
|
||||
readonly urisToOpen?: IURIToOpen[];
|
||||
readonly preferNewWindow?: boolean;
|
||||
readonly forceNewWindow?: boolean;
|
||||
readonly forceNewTabbedWindow?: boolean;
|
||||
|
||||
@@ -8,15 +8,15 @@ import * as os from 'os';
|
||||
import { IDisposable, dispose } from 'vs/base/common/lifecycle';
|
||||
import { assign } from 'vs/base/common/objects';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import product from 'vs/platform/node/product';
|
||||
import { IWindowsService, OpenContext, INativeOpenDialogOptions, IEnterWorkspaceResult, IMessageBoxResult, IDevToolsOptions, INewWindowOptions, IOpenSettings } from 'vs/platform/windows/common/windows';
|
||||
import product from 'vs/platform/product/node/product';
|
||||
import { IWindowsService, OpenContext, INativeOpenDialogOptions, IEnterWorkspaceResult, IMessageBoxResult, IDevToolsOptions, INewWindowOptions, IOpenSettings, IURIToOpen } from 'vs/platform/windows/common/windows';
|
||||
import { IEnvironmentService, ParsedArgs } from 'vs/platform/environment/common/environment';
|
||||
import { shell, crashReporter, app, Menu, clipboard } from 'electron';
|
||||
import { Event } from 'vs/base/common/event';
|
||||
import { IURLService, IURLHandler } from 'vs/platform/url/common/url';
|
||||
import { ILifecycleService } from 'vs/platform/lifecycle/electron-main/lifecycleMain';
|
||||
import { IWindowsMainService, ISharedProcess, ICodeWindow } from 'vs/platform/windows/electron-main/windows';
|
||||
import { IHistoryMainService, IRecentlyOpened } from 'vs/platform/history/common/history';
|
||||
import { IHistoryMainService, IRecentlyOpened, IRecent } from 'vs/platform/history/common/history';
|
||||
import { IWorkspaceIdentifier, ISingleFolderWorkspaceIdentifier } from 'vs/platform/workspaces/common/workspaces';
|
||||
import { ISerializableCommandAction } from 'vs/platform/actions/common/actions';
|
||||
import { Schemas } from 'vs/base/common/network';
|
||||
@@ -37,7 +37,7 @@ export class WindowsService implements IWindowsService, IURLHandler, IDisposable
|
||||
readonly onWindowMaximize: Event<number> = Event.filter(Event.fromNodeEventEmitter(app, 'browser-window-maximize', (_, w: Electron.BrowserWindow) => w.id), id => !!this.windowsMainService.getWindowById(id));
|
||||
readonly onWindowUnmaximize: Event<number> = Event.filter(Event.fromNodeEventEmitter(app, 'browser-window-unmaximize', (_, w: Electron.BrowserWindow) => w.id), id => !!this.windowsMainService.getWindowById(id));
|
||||
readonly onWindowFocus: Event<number> = Event.any(
|
||||
Event.map(Event.filter(Event.map(this.windowsMainService.onWindowsCountChanged, () => this.windowsMainService.getLastActiveWindow()), w => !!w), w => w.id),
|
||||
Event.map(Event.filter(Event.map(this.windowsMainService.onWindowsCountChanged, () => this.windowsMainService.getLastActiveWindow()), w => !!w), w => w!.id),
|
||||
Event.filter(Event.fromNodeEventEmitter(app, 'browser-window-focus', (_, w: Electron.BrowserWindow) => w.id), id => !!this.windowsMainService.getWindowById(id))
|
||||
);
|
||||
|
||||
@@ -156,13 +156,12 @@ export class WindowsService implements IWindowsService, IURLHandler, IDisposable
|
||||
return this.withWindow(windowId, codeWindow => codeWindow.setRepresentedFilename(fileName));
|
||||
}
|
||||
|
||||
async addRecentlyOpened(files: URI[]): Promise<void> {
|
||||
async addRecentlyOpened(recents: IRecent[]): Promise<void> {
|
||||
this.logService.trace('windowsService#addRecentlyOpened');
|
||||
|
||||
this.historyService.addRecentlyOpened(undefined, files);
|
||||
this.historyService.addRecentlyOpened(recents);
|
||||
}
|
||||
|
||||
async removeFromRecentlyOpened(paths: Array<IWorkspaceIdentifier | ISingleFolderWorkspaceIdentifier | URI | string>): Promise<void> {
|
||||
async removeFromRecentlyOpened(paths: URI[]): Promise<void> {
|
||||
this.logService.trace('windowsService#removeFromRecentlyOpened');
|
||||
|
||||
this.historyService.removeFromRecentlyOpened(paths);
|
||||
@@ -177,7 +176,7 @@ export class WindowsService implements IWindowsService, IURLHandler, IDisposable
|
||||
async getRecentlyOpened(windowId: number): Promise<IRecentlyOpened> {
|
||||
this.logService.trace('windowsService#getRecentlyOpened', windowId);
|
||||
|
||||
return this.withWindow(windowId, codeWindow => this.historyService.getRecentlyOpened(codeWindow.config.workspace || codeWindow.config.folderUri, codeWindow.config.filesToOpen), () => this.historyService.getRecentlyOpened())!;
|
||||
return this.withWindow(windowId, codeWindow => this.historyService.getRecentlyOpened(codeWindow.config.workspace, codeWindow.config.folderUri, codeWindow.config.filesToOpen), () => this.historyService.getRecentlyOpened())!;
|
||||
}
|
||||
|
||||
async newWindowTab(): Promise<void> {
|
||||
@@ -274,16 +273,16 @@ export class WindowsService implements IWindowsService, IURLHandler, IDisposable
|
||||
});
|
||||
}
|
||||
|
||||
async openWindow(windowId: number, paths: URI[], options?: IOpenSettings): Promise<void> {
|
||||
async openWindow(windowId: number, urisToOpen: IURIToOpen[], options?: IOpenSettings): Promise<void> {
|
||||
this.logService.trace('windowsService#openWindow');
|
||||
if (!paths || !paths.length) {
|
||||
if (!urisToOpen || !urisToOpen.length) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
this.windowsMainService.open({
|
||||
context: OpenContext.API,
|
||||
contextWindowId: windowId,
|
||||
urisToOpen: paths,
|
||||
urisToOpen: urisToOpen,
|
||||
cli: options && options.args ? { ...this.environmentService.args, ...options.args } : this.environmentService.args,
|
||||
forceNewWindow: options && options.forceNewWindow,
|
||||
forceReuseWindow: options && options.forceReuseWindow,
|
||||
@@ -324,10 +323,12 @@ export class WindowsService implements IWindowsService, IURLHandler, IDisposable
|
||||
console[severity].apply(console, ...messages);
|
||||
}
|
||||
|
||||
async showItemInFolder(path: string): Promise<void> {
|
||||
async showItemInFolder(path: URI): Promise<void> {
|
||||
this.logService.trace('windowsService#showItemInFolder');
|
||||
|
||||
shell.showItemInFolder(path);
|
||||
if (path.scheme === Schemas.file) {
|
||||
shell.showItemInFolder(path.fsPath);
|
||||
}
|
||||
}
|
||||
|
||||
async getActiveWindowId(): Promise<number | undefined> {
|
||||
@@ -421,14 +422,14 @@ export class WindowsService implements IWindowsService, IURLHandler, IDisposable
|
||||
|
||||
// Catch file URLs
|
||||
if (uri.authority === Schemas.file && !!uri.path) {
|
||||
this.openFileForURI(URI.file(uri.fsPath));
|
||||
this.openFileForURI({ uri: URI.file(uri.fsPath) }); // using fsPath on a non-file URI...
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private openFileForURI(uri: URI): void {
|
||||
private openFileForURI(uri: IURIToOpen): void {
|
||||
const cli = assign(Object.create(null), this.environmentService.args, { goto: true });
|
||||
const urisToOpen = [uri];
|
||||
|
||||
|
||||
@@ -4,13 +4,11 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
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, 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 { IServerChannel } from 'vs/base/parts/ipc/common/ipc';
|
||||
import { IWindowsService, IURIToOpen } from 'vs/platform/windows/common/windows';
|
||||
import { reviveWorkspaceIdentifier } from 'vs/platform/workspaces/common/workspaces';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { ParsedArgs } from 'vs/platform/environment/common/environment';
|
||||
import { IRecent, isRecentFile, isRecentFolder } from 'vs/platform/history/common/history';
|
||||
|
||||
export class WindowsChannel implements IServerChannel {
|
||||
|
||||
@@ -59,14 +57,17 @@ export class WindowsChannel implements IServerChannel {
|
||||
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: Array<IWorkspaceIdentifier | ISingleFolderWorkspaceIdentifier | URI | string> = arg;
|
||||
if (Array.isArray(paths)) {
|
||||
paths = paths.map(path => isWorkspaceIdentifier(path) || typeof path === 'string' ? path : URI.revive(path));
|
||||
case 'addRecentlyOpened': return this.service.addRecentlyOpened(arg.map((recent: IRecent) => {
|
||||
if (isRecentFile(recent)) {
|
||||
recent.fileUri = URI.revive(recent.fileUri);
|
||||
} else if (isRecentFolder(recent)) {
|
||||
recent.folderUri = URI.revive(recent.folderUri);
|
||||
} else {
|
||||
recent.workspace = reviveWorkspaceIdentifier(recent.workspace);
|
||||
}
|
||||
return this.service.removeFromRecentlyOpened(paths);
|
||||
}
|
||||
return recent;
|
||||
}));
|
||||
case 'removeFromRecentlyOpened': return this.service.removeFromRecentlyOpened(arg.map(URI.revive));
|
||||
case 'clearRecentlyOpened': return this.service.clearRecentlyOpened();
|
||||
case 'newWindowTab': return this.service.newWindowTab();
|
||||
case 'showPreviousWindowTab': return this.service.showPreviousWindowTab();
|
||||
@@ -85,7 +86,7 @@ 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] ? (<URI[]>arg[1]).map(r => URI.revive(r)) : arg[1], arg[2]);
|
||||
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 'openNewWindow': return this.service.openNewWindow(arg);
|
||||
case 'showWindow': return this.service.showWindow(arg);
|
||||
case 'getWindows': return this.service.getWindows();
|
||||
@@ -95,7 +96,7 @@ export class WindowsChannel implements IServerChannel {
|
||||
case 'toggleSharedProcess': return this.service.toggleSharedProcess();
|
||||
case 'quit': return this.service.quit();
|
||||
case 'log': return this.service.log(arg[0], arg[1]);
|
||||
case 'showItemInFolder': return this.service.showItemInFolder(arg);
|
||||
case 'showItemInFolder': return this.service.showItemInFolder(URI.revive(arg));
|
||||
case 'getActiveWindowId': return this.service.getActiveWindowId();
|
||||
case 'openExternal': return this.service.openExternal(arg);
|
||||
case 'startCrashReporter': return this.service.startCrashReporter(arg);
|
||||
@@ -105,223 +106,4 @@ export class WindowsChannel implements IServerChannel {
|
||||
|
||||
throw new Error(`Call not found: ${command}`);
|
||||
}
|
||||
}
|
||||
|
||||
export class WindowsChannelClient implements IWindowsService {
|
||||
|
||||
_serviceBrand: any;
|
||||
|
||||
constructor(private channel: IChannel) { }
|
||||
|
||||
get onWindowOpen(): Event<number> { return this.channel.listen('onWindowOpen'); }
|
||||
get onWindowFocus(): Event<number> { return this.channel.listen('onWindowFocus'); }
|
||||
get onWindowBlur(): Event<number> { return this.channel.listen('onWindowBlur'); }
|
||||
get onWindowMaximize(): Event<number> { return this.channel.listen('onWindowMaximize'); }
|
||||
get onWindowUnmaximize(): Event<number> { return this.channel.listen('onWindowUnmaximize'); }
|
||||
get onRecentlyOpenedChange(): Event<void> { return this.channel.listen('onRecentlyOpenedChange'); }
|
||||
|
||||
pickFileFolderAndOpen(options: INativeOpenDialogOptions): Promise<void> {
|
||||
return this.channel.call('pickFileFolderAndOpen', options);
|
||||
}
|
||||
|
||||
pickFileAndOpen(options: INativeOpenDialogOptions): Promise<void> {
|
||||
return this.channel.call('pickFileAndOpen', options);
|
||||
}
|
||||
|
||||
pickFolderAndOpen(options: INativeOpenDialogOptions): Promise<void> {
|
||||
return this.channel.call('pickFolderAndOpen', options);
|
||||
}
|
||||
|
||||
pickWorkspaceAndOpen(options: INativeOpenDialogOptions): Promise<void> {
|
||||
return this.channel.call('pickWorkspaceAndOpen', options);
|
||||
}
|
||||
|
||||
showMessageBox(windowId: number, options: MessageBoxOptions): Promise<IMessageBoxResult> {
|
||||
return this.channel.call('showMessageBox', [windowId, options]);
|
||||
}
|
||||
|
||||
showSaveDialog(windowId: number, options: SaveDialogOptions): Promise<string> {
|
||||
return this.channel.call('showSaveDialog', [windowId, options]);
|
||||
}
|
||||
|
||||
showOpenDialog(windowId: number, options: OpenDialogOptions): Promise<string[]> {
|
||||
return this.channel.call('showOpenDialog', [windowId, options]);
|
||||
}
|
||||
|
||||
reloadWindow(windowId: number, args?: ParsedArgs): Promise<void> {
|
||||
return this.channel.call('reloadWindow', [windowId, args]);
|
||||
}
|
||||
|
||||
openDevTools(windowId: number, options?: IDevToolsOptions): Promise<void> {
|
||||
return this.channel.call('openDevTools', [windowId, options]);
|
||||
}
|
||||
|
||||
toggleDevTools(windowId: number): Promise<void> {
|
||||
return this.channel.call('toggleDevTools', windowId);
|
||||
}
|
||||
|
||||
closeWorkspace(windowId: number): Promise<void> {
|
||||
return this.channel.call('closeWorkspace', windowId);
|
||||
}
|
||||
|
||||
enterWorkspace(windowId: number, path: URI): Promise<IEnterWorkspaceResult> {
|
||||
return this.channel.call('enterWorkspace', [windowId, path]);
|
||||
}
|
||||
|
||||
toggleFullScreen(windowId: number): Promise<void> {
|
||||
return this.channel.call('toggleFullScreen', windowId);
|
||||
}
|
||||
|
||||
setRepresentedFilename(windowId: number, fileName: string): Promise<void> {
|
||||
return this.channel.call('setRepresentedFilename', [windowId, fileName]);
|
||||
}
|
||||
|
||||
addRecentlyOpened(files: URI[]): Promise<void> {
|
||||
return this.channel.call('addRecentlyOpened', files);
|
||||
}
|
||||
|
||||
removeFromRecentlyOpened(paths: Array<IWorkspaceIdentifier | ISingleFolderWorkspaceIdentifier | URI>): Promise<void> {
|
||||
return this.channel.call('removeFromRecentlyOpened', paths);
|
||||
}
|
||||
|
||||
clearRecentlyOpened(): Promise<void> {
|
||||
return this.channel.call('clearRecentlyOpened');
|
||||
}
|
||||
|
||||
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(): Promise<void> {
|
||||
return this.channel.call('newWindowTab');
|
||||
}
|
||||
|
||||
showPreviousWindowTab(): Promise<void> {
|
||||
return this.channel.call('showPreviousWindowTab');
|
||||
}
|
||||
|
||||
showNextWindowTab(): Promise<void> {
|
||||
return this.channel.call('showNextWindowTab');
|
||||
}
|
||||
|
||||
moveWindowTabToNewWindow(): Promise<void> {
|
||||
return this.channel.call('moveWindowTabToNewWindow');
|
||||
}
|
||||
|
||||
mergeAllWindowTabs(): Promise<void> {
|
||||
return this.channel.call('mergeAllWindowTabs');
|
||||
}
|
||||
|
||||
toggleWindowTabsBar(): Promise<void> {
|
||||
return this.channel.call('toggleWindowTabsBar');
|
||||
}
|
||||
|
||||
focusWindow(windowId: number): Promise<void> {
|
||||
return this.channel.call('focusWindow', windowId);
|
||||
}
|
||||
|
||||
closeWindow(windowId: number): Promise<void> {
|
||||
return this.channel.call('closeWindow', windowId);
|
||||
}
|
||||
|
||||
isFocused(windowId: number): Promise<boolean> {
|
||||
return this.channel.call('isFocused', windowId);
|
||||
}
|
||||
|
||||
isMaximized(windowId: number): Promise<boolean> {
|
||||
return this.channel.call('isMaximized', windowId);
|
||||
}
|
||||
|
||||
maximizeWindow(windowId: number): Promise<void> {
|
||||
return this.channel.call('maximizeWindow', windowId);
|
||||
}
|
||||
|
||||
unmaximizeWindow(windowId: number): Promise<void> {
|
||||
return this.channel.call('unmaximizeWindow', windowId);
|
||||
}
|
||||
|
||||
minimizeWindow(windowId: number): Promise<void> {
|
||||
return this.channel.call('minimizeWindow', windowId);
|
||||
}
|
||||
|
||||
onWindowTitleDoubleClick(windowId: number): Promise<void> {
|
||||
return this.channel.call('onWindowTitleDoubleClick', windowId);
|
||||
}
|
||||
|
||||
setDocumentEdited(windowId: number, flag: boolean): Promise<void> {
|
||||
return this.channel.call('setDocumentEdited', [windowId, flag]);
|
||||
}
|
||||
|
||||
quit(): Promise<void> {
|
||||
return this.channel.call('quit');
|
||||
}
|
||||
|
||||
relaunch(options: { addArgs?: string[], removeArgs?: string[] }): Promise<void> {
|
||||
return this.channel.call('relaunch', [options]);
|
||||
}
|
||||
|
||||
whenSharedProcessReady(): Promise<void> {
|
||||
return this.channel.call('whenSharedProcessReady');
|
||||
}
|
||||
|
||||
toggleSharedProcess(): Promise<void> {
|
||||
return this.channel.call('toggleSharedProcess');
|
||||
}
|
||||
|
||||
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): Promise<void> {
|
||||
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 => { result.forEach(win => win.folderUri = win.folderUri ? URI.revive(win.folderUri) : win.folderUri); return result; });
|
||||
}
|
||||
|
||||
getWindowCount(): Promise<number> {
|
||||
return this.channel.call('getWindowCount');
|
||||
}
|
||||
|
||||
log(severity: string, ...messages: string[]): Promise<void> {
|
||||
return this.channel.call('log', [severity, messages]);
|
||||
}
|
||||
|
||||
showItemInFolder(path: string): Promise<void> {
|
||||
return this.channel.call('showItemInFolder', path);
|
||||
}
|
||||
|
||||
getActiveWindowId(): Promise<number | undefined> {
|
||||
return this.channel.call('getActiveWindowId');
|
||||
}
|
||||
|
||||
openExternal(url: string): Promise<boolean> {
|
||||
return this.channel.call('openExternal', url);
|
||||
}
|
||||
|
||||
startCrashReporter(config: CrashReporterStartOptions): Promise<void> {
|
||||
return this.channel.call('startCrashReporter', config);
|
||||
}
|
||||
|
||||
updateTouchBar(windowId: number, items: ISerializableCommandAction[][]): Promise<void> {
|
||||
return this.channel.call('updateTouchBar', [windowId, items]);
|
||||
}
|
||||
|
||||
openAboutDialog(): Promise<void> {
|
||||
return this.channel.call('openAboutDialog');
|
||||
}
|
||||
|
||||
resolveProxy(windowId: number, url: string): Promise<string | undefined> {
|
||||
return Promise.resolve(this.channel.call('resolveProxy', [windowId, url]));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user