mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
Merge VS Code 1.21 source code (#1067)
* Initial VS Code 1.21 file copy with patches * A few more merges * Post npm install * Fix batch of build breaks * Fix more build breaks * Fix more build errors * Fix more build breaks * Runtime fixes 1 * Get connection dialog working with some todos * Fix a few packaging issues * Copy several node_modules to package build to fix loader issues * Fix breaks from master * A few more fixes * Make tests pass * First pass of license header updates * Second pass of license header updates * Fix restore dialog issues * Remove add additional themes menu items * fix select box issues where the list doesn't show up * formatting * Fix editor dispose issue * Copy over node modules to correct location on all platforms
This commit is contained in:
@@ -15,6 +15,7 @@ import { IWorkspaceIdentifier, IWorkspaceFolderCreationData } from 'vs/platform/
|
||||
import { IRecentlyOpened } from 'vs/platform/history/common/history';
|
||||
import { ICommandAction } from 'vs/platform/actions/common/actions';
|
||||
import { PerformanceEntry } from 'vs/base/common/performance';
|
||||
import { LogLevel } from 'vs/platform/log/common/log';
|
||||
|
||||
export const IWindowsService = createDecorator<IWindowsService>('windowsService');
|
||||
|
||||
@@ -98,11 +99,16 @@ export interface IWindowsService {
|
||||
onWindowFocus: Event<number>;
|
||||
onWindowBlur: Event<number>;
|
||||
|
||||
// Dialogs
|
||||
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>;
|
||||
showMessageBox(windowId: number, options: MessageBoxOptions): TPromise<IMessageBoxResult>;
|
||||
showSaveDialog(windowId: number, options: SaveDialogOptions): TPromise<string>;
|
||||
showOpenDialog(windowId: number, options: OpenDialogOptions): TPromise<string[]>;
|
||||
|
||||
reloadWindow(windowId: number, args?: ParsedArgs): TPromise<void>;
|
||||
openDevTools(windowId: number): TPromise<void>;
|
||||
toggleDevTools(windowId: number): TPromise<void>;
|
||||
closeWorkspace(windowId: number): TPromise<void>;
|
||||
@@ -154,6 +160,8 @@ export interface IWindowsService {
|
||||
|
||||
// TODO: this is a bit backwards
|
||||
startCrashReporter(config: CrashReporterStartOptions): TPromise<void>;
|
||||
|
||||
openAboutDialog(): TPromise<void>;
|
||||
}
|
||||
|
||||
export const IWindowService = createDecorator<IWindowService>('windowService');
|
||||
@@ -175,7 +183,7 @@ export interface IWindowService {
|
||||
pickFileAndOpen(options: INativeOpenDialogOptions): TPromise<void>;
|
||||
pickFolderAndOpen(options: INativeOpenDialogOptions): TPromise<void>;
|
||||
pickWorkspaceAndOpen(options: INativeOpenDialogOptions): TPromise<void>;
|
||||
reloadWindow(): TPromise<void>;
|
||||
reloadWindow(args?: ParsedArgs): TPromise<void>;
|
||||
openDevTools(): TPromise<void>;
|
||||
toggleDevTools(): TPromise<void>;
|
||||
closeWorkspace(): TPromise<void>;
|
||||
@@ -191,10 +199,9 @@ export interface IWindowService {
|
||||
setDocumentEdited(flag: boolean): TPromise<void>;
|
||||
onWindowTitleDoubleClick(): TPromise<void>;
|
||||
show(): TPromise<void>;
|
||||
showMessageBox(options: MessageBoxOptions): number;
|
||||
showSaveDialog(options: SaveDialogOptions): string;
|
||||
showOpenDialog(options: OpenDialogOptions): string[];
|
||||
showMessageBoxWithCheckbox(options: MessageBoxOptions): TPromise<IMessageBoxResult>;
|
||||
showMessageBox(options: MessageBoxOptions): TPromise<IMessageBoxResult>;
|
||||
showSaveDialog(options: SaveDialogOptions): TPromise<string>;
|
||||
showOpenDialog(options: OpenDialogOptions): TPromise<string[]>;
|
||||
}
|
||||
|
||||
export type MenuBarVisibility = 'default' | 'visible' | 'toggle' | 'hidden';
|
||||
@@ -207,7 +214,6 @@ export interface IWindowSettings {
|
||||
openFilesInNewWindow: 'on' | 'off' | 'default';
|
||||
openFoldersInNewWindow: 'on' | 'off' | 'default';
|
||||
restoreWindows: 'all' | 'folders' | 'one' | 'none';
|
||||
reopenFolders: 'all' | 'one' | 'none'; // TODO@Ben deprecated
|
||||
restoreFullscreen: boolean;
|
||||
zoomLevel: number;
|
||||
titleBarStyle: 'native' | 'custom';
|
||||
@@ -293,6 +299,8 @@ export interface IAddFoldersRequest {
|
||||
|
||||
export interface IWindowConfiguration extends ParsedArgs, IOpenFileRequest {
|
||||
machineId: string;
|
||||
windowId: number;
|
||||
logLevel: LogLevel;
|
||||
|
||||
appRoot: string;
|
||||
execPath: string;
|
||||
|
||||
@@ -8,11 +8,12 @@
|
||||
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, IEnterWorkspaceResult, CrashReporterStartOptions } from 'vs/platform/windows/common/windows';
|
||||
import { IWindowsService, INativeOpenDialogOptions, IEnterWorkspaceResult, CrashReporterStartOptions, IMessageBoxResult, MessageBoxOptions, SaveDialogOptions, OpenDialogOptions } from 'vs/platform/windows/common/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';
|
||||
import { ParsedArgs } from 'vs/platform/environment/common/environment';
|
||||
|
||||
export interface IWindowsChannel extends IChannel {
|
||||
call(command: 'event:onWindowOpen'): TPromise<number>;
|
||||
@@ -22,7 +23,10 @@ export interface IWindowsChannel extends IChannel {
|
||||
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: 'showMessageBox', arg: [number, MessageBoxOptions]): TPromise<IMessageBoxResult>;
|
||||
call(command: 'showSaveDialog', arg: [number, SaveDialogOptions]): TPromise<string>;
|
||||
call(command: 'showOpenDialog', arg: [number, OpenDialogOptions]): TPromise<string[]>;
|
||||
call(command: 'reloadWindow', arg: [number, ParsedArgs]): TPromise<void>;
|
||||
call(command: 'toggleDevTools', arg: number): TPromise<void>;
|
||||
call(command: 'closeWorkspace', arg: number): TPromise<void>;
|
||||
call(command: 'createAndEnterWorkspace', arg: [number, IWorkspaceFolderCreationData[], string]): TPromise<IEnterWorkspaceResult>;
|
||||
@@ -60,6 +64,7 @@ export interface IWindowsChannel extends IChannel {
|
||||
call(command: 'showItemInFolder', arg: string): TPromise<void>;
|
||||
call(command: 'openExternal', arg: string): TPromise<boolean>;
|
||||
call(command: 'startCrashReporter', arg: CrashReporterStartOptions): TPromise<void>;
|
||||
call(command: 'openAboutDialog'): TPromise<void>;
|
||||
call(command: string, arg?: any): TPromise<any>;
|
||||
}
|
||||
|
||||
@@ -84,7 +89,10 @@ export class WindowsChannel implements IWindowsChannel {
|
||||
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 'showMessageBox': return this.service.showMessageBox(arg[0], arg[1]);
|
||||
case 'showSaveDialog': return this.service.showSaveDialog(arg[0], arg[1]);
|
||||
case 'showOpenDialog': return this.service.showOpenDialog(arg[0], arg[1]);
|
||||
case 'reloadWindow': return this.service.reloadWindow(arg[0], arg[1]);
|
||||
case 'openDevTools': return this.service.openDevTools(arg);
|
||||
case 'toggleDevTools': return this.service.toggleDevTools(arg);
|
||||
case 'closeWorkspace': return this.service.closeWorkspace(arg);
|
||||
@@ -136,6 +144,7 @@ export class WindowsChannel implements IWindowsChannel {
|
||||
case 'showItemInFolder': return this.service.showItemInFolder(arg);
|
||||
case 'openExternal': return this.service.openExternal(arg);
|
||||
case 'startCrashReporter': return this.service.startCrashReporter(arg);
|
||||
case 'openAboutDialog': return this.service.openAboutDialog();
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
@@ -172,8 +181,20 @@ export class WindowsChannelClient implements IWindowsService {
|
||||
return this.channel.call('pickWorkspaceAndOpen', options);
|
||||
}
|
||||
|
||||
reloadWindow(windowId: number): TPromise<void> {
|
||||
return this.channel.call('reloadWindow', windowId);
|
||||
showMessageBox(windowId: number, options: MessageBoxOptions): TPromise<IMessageBoxResult> {
|
||||
return this.channel.call('showMessageBox', [windowId, options]);
|
||||
}
|
||||
|
||||
showSaveDialog(windowId: number, options: SaveDialogOptions): TPromise<string> {
|
||||
return this.channel.call('showSaveDialog', [windowId, options]);
|
||||
}
|
||||
|
||||
showOpenDialog(windowId: number, options: OpenDialogOptions): TPromise<string[]> {
|
||||
return this.channel.call('showOpenDialog', [windowId, options]);
|
||||
}
|
||||
|
||||
reloadWindow(windowId: number, args?: ParsedArgs): TPromise<void> {
|
||||
return this.channel.call('reloadWindow', [windowId, args]);
|
||||
}
|
||||
|
||||
openDevTools(windowId: number): TPromise<void> {
|
||||
@@ -327,4 +348,8 @@ export class WindowsChannelClient implements IWindowsService {
|
||||
updateTouchBar(windowId: number, items: ICommandAction[][]): TPromise<void> {
|
||||
return this.channel.call('updateTouchBar', [windowId, items]);
|
||||
}
|
||||
|
||||
openAboutDialog(): TPromise<void> {
|
||||
return this.channel.call('openAboutDialog');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,12 +8,10 @@
|
||||
import Event, { filterEvent, mapEvent, anyEvent } from 'vs/base/common/event';
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import { IWindowService, IWindowsService, INativeOpenDialogOptions, IEnterWorkspaceResult, IMessageBoxResult, IWindowConfiguration } 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';
|
||||
import { ParsedArgs } from 'vs/platform/environment/common/environment';
|
||||
|
||||
export class WindowService implements IWindowService {
|
||||
|
||||
@@ -63,8 +61,8 @@ export class WindowService implements IWindowService {
|
||||
return this.windowsService.pickWorkspaceAndOpen(options);
|
||||
}
|
||||
|
||||
reloadWindow(): TPromise<void> {
|
||||
return this.windowsService.reloadWindow(this.windowId);
|
||||
reloadWindow(args?: ParsedArgs): TPromise<void> {
|
||||
return this.windowsService.reloadWindow(this.windowId, args);
|
||||
}
|
||||
|
||||
openDevTools(): TPromise<void> {
|
||||
@@ -123,42 +121,16 @@ export class WindowService implements IWindowService {
|
||||
return this.windowsService.showWindow(this.windowId);
|
||||
}
|
||||
|
||||
showMessageBox(options: Electron.MessageBoxOptions): number {
|
||||
return remote.dialog.showMessageBox(remote.getCurrentWindow(), options);
|
||||
showMessageBox(options: Electron.MessageBoxOptions): TPromise<IMessageBoxResult> {
|
||||
return this.windowsService.showMessageBox(this.windowId, options);
|
||||
}
|
||||
|
||||
showMessageBoxWithCheckbox(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): TPromise<string> {
|
||||
return this.windowsService.showSaveDialog(this.windowId, options);
|
||||
}
|
||||
|
||||
showSaveDialog(options: Electron.SaveDialogOptions): string {
|
||||
|
||||
function normalizePath(path: string): string {
|
||||
if (path && isMacintosh) {
|
||||
path = normalizeNFC(path); // normalize paths returned from the OS
|
||||
}
|
||||
|
||||
return path;
|
||||
}
|
||||
|
||||
return normalizePath(remote.dialog.showSaveDialog(remote.getCurrentWindow(), options)); // https://github.com/electron/electron/issues/4936
|
||||
}
|
||||
|
||||
showOpenDialog(options: Electron.OpenDialogOptions): string[] {
|
||||
|
||||
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 normalizePaths(remote.dialog.showOpenDialog(remote.getCurrentWindow(), options)); // https://github.com/electron/electron/issues/4936
|
||||
showOpenDialog(options: Electron.OpenDialogOptions): TPromise<string[]> {
|
||||
return this.windowsService.showOpenDialog(this.windowId, options);
|
||||
}
|
||||
|
||||
updateTouchBar(items: ICommandAction[][]): TPromise<void> {
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
'use strict';
|
||||
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import { OpenContext, IWindowConfiguration, ReadyState, INativeOpenDialogOptions, IEnterWorkspaceResult } from 'vs/platform/windows/common/windows';
|
||||
import { OpenContext, IWindowConfiguration, ReadyState, INativeOpenDialogOptions, IEnterWorkspaceResult, IMessageBoxResult } 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';
|
||||
@@ -69,6 +69,9 @@ export interface IWindowsMainService {
|
||||
pickFolderAndOpen(options: INativeOpenDialogOptions): void;
|
||||
pickFileAndOpen(options: INativeOpenDialogOptions): void;
|
||||
pickWorkspaceAndOpen(options: INativeOpenDialogOptions): void;
|
||||
showMessageBox(options: Electron.MessageBoxOptions, win?: ICodeWindow): TPromise<IMessageBoxResult>;
|
||||
showSaveDialog(options: Electron.SaveDialogOptions, win?: ICodeWindow): TPromise<string>;
|
||||
showOpenDialog(options: Electron.OpenDialogOptions, win?: ICodeWindow): TPromise<string[]>;
|
||||
focusLastActive(cli: ParsedArgs, context: OpenContext): ICodeWindow;
|
||||
getLastActiveWindow(): ICodeWindow;
|
||||
waitForWindowCloseOrLoad(windowId: number): TPromise<void>;
|
||||
|
||||
@@ -5,13 +5,15 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
import * as nls from 'vs/nls';
|
||||
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, IEnterWorkspaceResult } from 'vs/platform/windows/common/windows';
|
||||
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
|
||||
import { shell, crashReporter, app, Menu } from 'electron';
|
||||
import product from 'vs/platform/node/product';
|
||||
import { IWindowsService, OpenContext, INativeOpenDialogOptions, IEnterWorkspaceResult, IMessageBoxResult } 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, { chain, fromNodeEventEmitter } from 'vs/base/common/event';
|
||||
import { IURLService } from 'vs/platform/url/common/url';
|
||||
import { ILifecycleService } from 'vs/platform/lifecycle/electron-main/lifecycleMain';
|
||||
@@ -19,6 +21,10 @@ import { IWindowsMainService, ISharedProcess } from 'vs/platform/windows/electro
|
||||
import { IHistoryMainService, IRecentlyOpened } from 'vs/platform/history/common/history';
|
||||
import { IWorkspaceIdentifier, IWorkspaceFolderCreationData } from 'vs/platform/workspaces/common/workspaces';
|
||||
import { ICommandAction } from 'vs/platform/actions/common/actions';
|
||||
import { Schemas } from 'vs/base/common/network';
|
||||
import { mnemonicButtonLabel } from 'vs/base/common/labels';
|
||||
import { isWindows } from 'vs/base/common/platform';
|
||||
import { ILogService } from '../../log/common/log';
|
||||
|
||||
export class WindowsService implements IWindowsService, IDisposable {
|
||||
|
||||
@@ -36,11 +42,12 @@ export class WindowsService implements IWindowsService, IDisposable {
|
||||
@IEnvironmentService private environmentService: IEnvironmentService,
|
||||
@IURLService urlService: IURLService,
|
||||
@ILifecycleService private lifecycleService: ILifecycleService,
|
||||
@IHistoryMainService private historyService: IHistoryMainService
|
||||
@IHistoryMainService private historyService: IHistoryMainService,
|
||||
@ILogService private logService: ILogService
|
||||
) {
|
||||
// Catch file URLs
|
||||
chain(urlService.onOpenURL)
|
||||
.filter(uri => uri.authority === 'file' && !!uri.path)
|
||||
.filter(uri => uri.authority === Schemas.file && !!uri.path)
|
||||
.map(uri => URI.file(uri.fsPath))
|
||||
.on(this.openFileForURI, this, this.disposables);
|
||||
|
||||
@@ -52,40 +59,67 @@ export class WindowsService implements IWindowsService, IDisposable {
|
||||
}
|
||||
|
||||
pickFileFolderAndOpen(options: INativeOpenDialogOptions): TPromise<void> {
|
||||
this.logService.trace('windowsService#pickFileFolderAndOpen');
|
||||
this.windowsMainService.pickFileFolderAndOpen(options);
|
||||
|
||||
return TPromise.as(null);
|
||||
}
|
||||
|
||||
pickFileAndOpen(options: INativeOpenDialogOptions): TPromise<void> {
|
||||
this.logService.trace('windowsService#pickFileAndOpen');
|
||||
this.windowsMainService.pickFileAndOpen(options);
|
||||
|
||||
return TPromise.as(null);
|
||||
}
|
||||
|
||||
pickFolderAndOpen(options: INativeOpenDialogOptions): TPromise<void> {
|
||||
this.logService.trace('windowsService#pickFolderAndOpen');
|
||||
this.windowsMainService.pickFolderAndOpen(options);
|
||||
|
||||
return TPromise.as(null);
|
||||
}
|
||||
|
||||
pickWorkspaceAndOpen(options: INativeOpenDialogOptions): TPromise<void> {
|
||||
this.logService.trace('windowsService#pickWorkspaceAndOpen');
|
||||
this.windowsMainService.pickWorkspaceAndOpen(options);
|
||||
|
||||
return TPromise.as(null);
|
||||
}
|
||||
|
||||
reloadWindow(windowId: number): TPromise<void> {
|
||||
showMessageBox(windowId: number, options: Electron.MessageBoxOptions): TPromise<IMessageBoxResult> {
|
||||
this.logService.trace('windowsService#showMessageBox', windowId);
|
||||
const codeWindow = this.windowsMainService.getWindowById(windowId);
|
||||
|
||||
return this.windowsMainService.showMessageBox(options, codeWindow);
|
||||
}
|
||||
|
||||
showSaveDialog(windowId: number, options: Electron.SaveDialogOptions): TPromise<string> {
|
||||
this.logService.trace('windowsService#showSaveDialog', windowId);
|
||||
const codeWindow = this.windowsMainService.getWindowById(windowId);
|
||||
|
||||
return this.windowsMainService.showSaveDialog(options, codeWindow);
|
||||
}
|
||||
|
||||
showOpenDialog(windowId: number, options: Electron.OpenDialogOptions): TPromise<string[]> {
|
||||
this.logService.trace('windowsService#showOpenDialog', windowId);
|
||||
const codeWindow = this.windowsMainService.getWindowById(windowId);
|
||||
|
||||
return this.windowsMainService.showOpenDialog(options, codeWindow);
|
||||
}
|
||||
|
||||
reloadWindow(windowId: number, args: ParsedArgs): TPromise<void> {
|
||||
this.logService.trace('windowsService#reloadWindow', windowId);
|
||||
const codeWindow = this.windowsMainService.getWindowById(windowId);
|
||||
|
||||
if (codeWindow) {
|
||||
this.windowsMainService.reload(codeWindow);
|
||||
this.windowsMainService.reload(codeWindow, args);
|
||||
}
|
||||
|
||||
return TPromise.as(null);
|
||||
}
|
||||
|
||||
openDevTools(windowId: number): TPromise<void> {
|
||||
this.logService.trace('windowsService#openDevTools', windowId);
|
||||
const codeWindow = this.windowsMainService.getWindowById(windowId);
|
||||
|
||||
if (codeWindow) {
|
||||
@@ -96,6 +130,7 @@ export class WindowsService implements IWindowsService, IDisposable {
|
||||
}
|
||||
|
||||
toggleDevTools(windowId: number): TPromise<void> {
|
||||
this.logService.trace('windowsService#toggleDevTools', windowId);
|
||||
const codeWindow = this.windowsMainService.getWindowById(windowId);
|
||||
|
||||
if (codeWindow) {
|
||||
@@ -111,6 +146,7 @@ export class WindowsService implements IWindowsService, IDisposable {
|
||||
}
|
||||
|
||||
updateTouchBar(windowId: number, items: ICommandAction[][]): TPromise<void> {
|
||||
this.logService.trace('windowsService#updateTouchBar', windowId);
|
||||
const codeWindow = this.windowsMainService.getWindowById(windowId);
|
||||
|
||||
if (codeWindow) {
|
||||
@@ -121,6 +157,7 @@ export class WindowsService implements IWindowsService, IDisposable {
|
||||
}
|
||||
|
||||
closeWorkspace(windowId: number): TPromise<void> {
|
||||
this.logService.trace('windowsService#closeWorkspace', windowId);
|
||||
const codeWindow = this.windowsMainService.getWindowById(windowId);
|
||||
|
||||
if (codeWindow) {
|
||||
@@ -131,6 +168,7 @@ export class WindowsService implements IWindowsService, IDisposable {
|
||||
}
|
||||
|
||||
createAndEnterWorkspace(windowId: number, folders?: IWorkspaceFolderCreationData[], path?: string): TPromise<IEnterWorkspaceResult> {
|
||||
this.logService.trace('windowsService#createAndEnterWorkspace', windowId);
|
||||
const codeWindow = this.windowsMainService.getWindowById(windowId);
|
||||
|
||||
if (codeWindow) {
|
||||
@@ -141,6 +179,7 @@ export class WindowsService implements IWindowsService, IDisposable {
|
||||
}
|
||||
|
||||
saveAndEnterWorkspace(windowId: number, path: string): TPromise<IEnterWorkspaceResult> {
|
||||
this.logService.trace('windowsService#saveAndEnterWorkspace', windowId);
|
||||
const codeWindow = this.windowsMainService.getWindowById(windowId);
|
||||
|
||||
if (codeWindow) {
|
||||
@@ -151,6 +190,7 @@ export class WindowsService implements IWindowsService, IDisposable {
|
||||
}
|
||||
|
||||
toggleFullScreen(windowId: number): TPromise<void> {
|
||||
this.logService.trace('windowsService#toggleFullScreen', windowId);
|
||||
const codeWindow = this.windowsMainService.getWindowById(windowId);
|
||||
|
||||
if (codeWindow) {
|
||||
@@ -161,6 +201,7 @@ export class WindowsService implements IWindowsService, IDisposable {
|
||||
}
|
||||
|
||||
setRepresentedFilename(windowId: number, fileName: string): TPromise<void> {
|
||||
this.logService.trace('windowsService#setRepresentedFilename', windowId);
|
||||
const codeWindow = this.windowsMainService.getWindowById(windowId);
|
||||
|
||||
if (codeWindow) {
|
||||
@@ -171,24 +212,28 @@ export class WindowsService implements IWindowsService, IDisposable {
|
||||
}
|
||||
|
||||
addRecentlyOpened(files: string[]): TPromise<void> {
|
||||
this.logService.trace('windowsService#addRecentlyOpened');
|
||||
this.historyService.addRecentlyOpened(void 0, files);
|
||||
|
||||
return TPromise.as(null);
|
||||
}
|
||||
|
||||
removeFromRecentlyOpened(paths: string[]): TPromise<void> {
|
||||
this.logService.trace('windowsService#removeFromRecentlyOpened');
|
||||
this.historyService.removeFromRecentlyOpened(paths);
|
||||
|
||||
return TPromise.as(null);
|
||||
}
|
||||
|
||||
clearRecentlyOpened(): TPromise<void> {
|
||||
this.logService.trace('windowsService#clearRecentlyOpened');
|
||||
this.historyService.clearRecentlyOpened();
|
||||
|
||||
return TPromise.as(null);
|
||||
}
|
||||
|
||||
getRecentlyOpened(windowId: number): TPromise<IRecentlyOpened> {
|
||||
this.logService.trace('windowsService#getRecentlyOpened', windowId);
|
||||
const codeWindow = this.windowsMainService.getWindowById(windowId);
|
||||
|
||||
if (codeWindow) {
|
||||
@@ -199,36 +244,42 @@ export class WindowsService implements IWindowsService, IDisposable {
|
||||
}
|
||||
|
||||
showPreviousWindowTab(): TPromise<void> {
|
||||
this.logService.trace('windowsService#showPreviousWindowTab');
|
||||
Menu.sendActionToFirstResponder('selectPreviousTab:');
|
||||
|
||||
return TPromise.as(void 0);
|
||||
}
|
||||
|
||||
showNextWindowTab(): TPromise<void> {
|
||||
this.logService.trace('windowsService#showNextWindowTab');
|
||||
Menu.sendActionToFirstResponder('selectNextTab:');
|
||||
|
||||
return TPromise.as(void 0);
|
||||
}
|
||||
|
||||
moveWindowTabToNewWindow(): TPromise<void> {
|
||||
this.logService.trace('windowsService#moveWindowTabToNewWindow');
|
||||
Menu.sendActionToFirstResponder('moveTabToNewWindow:');
|
||||
|
||||
return TPromise.as(void 0);
|
||||
}
|
||||
|
||||
mergeAllWindowTabs(): TPromise<void> {
|
||||
this.logService.trace('windowsService#mergeAllWindowTabs');
|
||||
Menu.sendActionToFirstResponder('mergeAllWindows:');
|
||||
|
||||
return TPromise.as(void 0);
|
||||
}
|
||||
|
||||
toggleWindowTabsBar(): TPromise<void> {
|
||||
this.logService.trace('windowsService#toggleWindowTabsBar');
|
||||
Menu.sendActionToFirstResponder('toggleTabBar:');
|
||||
|
||||
return TPromise.as(void 0);
|
||||
}
|
||||
|
||||
focusWindow(windowId: number): TPromise<void> {
|
||||
this.logService.trace('windowsService#focusWindow', windowId);
|
||||
const codeWindow = this.windowsMainService.getWindowById(windowId);
|
||||
|
||||
if (codeWindow) {
|
||||
@@ -239,6 +290,7 @@ export class WindowsService implements IWindowsService, IDisposable {
|
||||
}
|
||||
|
||||
closeWindow(windowId: number): TPromise<void> {
|
||||
this.logService.trace('windowsService#closeWindow', windowId);
|
||||
const codeWindow = this.windowsMainService.getWindowById(windowId);
|
||||
|
||||
if (codeWindow) {
|
||||
@@ -249,6 +301,7 @@ export class WindowsService implements IWindowsService, IDisposable {
|
||||
}
|
||||
|
||||
isFocused(windowId: number): TPromise<boolean> {
|
||||
this.logService.trace('windowsService#isFocused', windowId);
|
||||
const codeWindow = this.windowsMainService.getWindowById(windowId);
|
||||
|
||||
if (codeWindow) {
|
||||
@@ -259,6 +312,7 @@ export class WindowsService implements IWindowsService, IDisposable {
|
||||
}
|
||||
|
||||
isMaximized(windowId: number): TPromise<boolean> {
|
||||
this.logService.trace('windowsService#isMaximized', windowId);
|
||||
const codeWindow = this.windowsMainService.getWindowById(windowId);
|
||||
|
||||
if (codeWindow) {
|
||||
@@ -269,6 +323,7 @@ export class WindowsService implements IWindowsService, IDisposable {
|
||||
}
|
||||
|
||||
maximizeWindow(windowId: number): TPromise<void> {
|
||||
this.logService.trace('windowsService#maximizeWindow', windowId);
|
||||
const codeWindow = this.windowsMainService.getWindowById(windowId);
|
||||
|
||||
if (codeWindow) {
|
||||
@@ -279,6 +334,7 @@ export class WindowsService implements IWindowsService, IDisposable {
|
||||
}
|
||||
|
||||
unmaximizeWindow(windowId: number): TPromise<void> {
|
||||
this.logService.trace('windowsService#unmaximizeWindow', windowId);
|
||||
const codeWindow = this.windowsMainService.getWindowById(windowId);
|
||||
|
||||
if (codeWindow) {
|
||||
@@ -289,6 +345,7 @@ export class WindowsService implements IWindowsService, IDisposable {
|
||||
}
|
||||
|
||||
onWindowTitleDoubleClick(windowId: number): TPromise<void> {
|
||||
this.logService.trace('windowsService#onWindowTitleDoubleClick', windowId);
|
||||
const codeWindow = this.windowsMainService.getWindowById(windowId);
|
||||
|
||||
if (codeWindow) {
|
||||
@@ -299,6 +356,7 @@ export class WindowsService implements IWindowsService, IDisposable {
|
||||
}
|
||||
|
||||
setDocumentEdited(windowId: number, flag: boolean): TPromise<void> {
|
||||
this.logService.trace('windowsService#setDocumentEdited', windowId);
|
||||
const codeWindow = this.windowsMainService.getWindowById(windowId);
|
||||
|
||||
if (codeWindow && codeWindow.win.isDocumentEdited() !== flag) {
|
||||
@@ -309,6 +367,7 @@ export class WindowsService implements IWindowsService, IDisposable {
|
||||
}
|
||||
|
||||
openWindow(paths: string[], options?: { forceNewWindow?: boolean, forceReuseWindow?: boolean, forceOpenWorkspaceAsFile?: boolean }): TPromise<void> {
|
||||
this.logService.trace('windowsService#openWindow');
|
||||
if (!paths || !paths.length) {
|
||||
return TPromise.as(null);
|
||||
}
|
||||
@@ -326,11 +385,13 @@ export class WindowsService implements IWindowsService, IDisposable {
|
||||
}
|
||||
|
||||
openNewWindow(): TPromise<void> {
|
||||
this.logService.trace('windowsService#openNewWindow');
|
||||
this.windowsMainService.openNewWindow(OpenContext.API);
|
||||
return TPromise.as(null);
|
||||
}
|
||||
|
||||
showWindow(windowId: number): TPromise<void> {
|
||||
this.logService.trace('windowsService#showWindow', windowId);
|
||||
const codeWindow = this.windowsMainService.getWindowById(windowId);
|
||||
|
||||
if (codeWindow) {
|
||||
@@ -341,6 +402,7 @@ export class WindowsService implements IWindowsService, IDisposable {
|
||||
}
|
||||
|
||||
getWindows(): TPromise<{ id: number; workspace?: IWorkspaceIdentifier; folderPath?: string; title: string; filename?: string; }[]> {
|
||||
this.logService.trace('windowsService#getWindows');
|
||||
const windows = this.windowsMainService.getWindows();
|
||||
const result = windows.map(w => ({ id: w.id, workspace: w.openedWorkspace, openedFolderPath: w.openedFolderPath, title: w.win.getTitle(), filename: w.getRepresentedFilename() }));
|
||||
|
||||
@@ -348,6 +410,7 @@ export class WindowsService implements IWindowsService, IDisposable {
|
||||
}
|
||||
|
||||
getWindowCount(): TPromise<number> {
|
||||
this.logService.trace('windowsService#getWindowCount');
|
||||
return TPromise.as(this.windowsMainService.getWindows().length);
|
||||
}
|
||||
|
||||
@@ -357,39 +420,82 @@ export class WindowsService implements IWindowsService, IDisposable {
|
||||
}
|
||||
|
||||
showItemInFolder(path: string): TPromise<void> {
|
||||
this.logService.trace('windowsService#showItemInFolder');
|
||||
shell.showItemInFolder(path);
|
||||
return TPromise.as(null);
|
||||
}
|
||||
|
||||
openExternal(url: string): TPromise<boolean> {
|
||||
this.logService.trace('windowsService#openExternal');
|
||||
return TPromise.as(shell.openExternal(url));
|
||||
}
|
||||
|
||||
startCrashReporter(config: Electron.CrashReporterStartOptions): TPromise<void> {
|
||||
this.logService.trace('windowsService#startCrashReporter');
|
||||
crashReporter.start(config);
|
||||
return TPromise.as(null);
|
||||
}
|
||||
|
||||
quit(): TPromise<void> {
|
||||
this.logService.trace('windowsService#quit');
|
||||
this.windowsMainService.quit();
|
||||
return TPromise.as(null);
|
||||
}
|
||||
|
||||
relaunch(options: { addArgs?: string[], removeArgs?: string[] }): TPromise<void> {
|
||||
this.logService.trace('windowsService#relaunch');
|
||||
this.lifecycleService.relaunch(options);
|
||||
|
||||
return TPromise.as(null);
|
||||
}
|
||||
|
||||
whenSharedProcessReady(): TPromise<void> {
|
||||
this.logService.trace('windowsService#whenSharedProcessReady');
|
||||
return this.sharedProcess.whenReady();
|
||||
}
|
||||
|
||||
toggleSharedProcess(): TPromise<void> {
|
||||
this.logService.trace('windowsService#toggleSharedProcess');
|
||||
this.sharedProcess.toggle();
|
||||
return TPromise.as(null);
|
||||
}
|
||||
|
||||
openAboutDialog(): TPromise<void> {
|
||||
this.logService.trace('windowsService#openAboutDialog');
|
||||
const lastActiveWindow = this.windowsMainService.getFocusedWindow() || this.windowsMainService.getLastActiveWindow();
|
||||
|
||||
const detail = nls.localize('aboutDetail',
|
||||
"Version {0}\nCommit {1}\nDate {2}\nShell {3}\nRenderer {4}\nNode {5}\nArchitecture {6}",
|
||||
app.getVersion(),
|
||||
product.commit || 'Unknown',
|
||||
product.date || 'Unknown',
|
||||
process.versions['electron'],
|
||||
process.versions['chrome'],
|
||||
process.versions['node'],
|
||||
process.arch
|
||||
);
|
||||
|
||||
const buttons = [nls.localize('okButton', "OK")];
|
||||
if (isWindows) {
|
||||
buttons.push(mnemonicButtonLabel(nls.localize({ key: 'copy', comment: ['&& denotes a mnemonic'] }, "&&Copy"))); // https://github.com/Microsoft/vscode/issues/37608
|
||||
}
|
||||
|
||||
this.windowsMainService.showMessageBox({
|
||||
title: product.nameLong,
|
||||
type: 'info',
|
||||
message: product.nameLong,
|
||||
detail: `\n${detail}`,
|
||||
buttons,
|
||||
noLink: true
|
||||
}, lastActiveWindow).then(result => {
|
||||
if (isWindows && result.button === 1) {
|
||||
clipboard.writeText(detail);
|
||||
}
|
||||
});
|
||||
|
||||
return TPromise.as(null);
|
||||
}
|
||||
|
||||
private openFileForURI(uri: URI): TPromise<void> {
|
||||
const cli = assign(Object.create(null), this.environmentService.args, { goto: true });
|
||||
const pathsToOpen = [uri.fsPath];
|
||||
|
||||
Reference in New Issue
Block a user