mirror of
https://github.com/microsoft/vscode.git
synced 2026-09-04 01:44:18 +01:00
debt week code cleanup
- avoid public modifier - use Disposable where applicable - fix some event handler leaks - clean up some TODO@ben
This commit is contained in:
@@ -261,7 +261,7 @@ export class CodeApplication {
|
||||
}
|
||||
}
|
||||
|
||||
public startup(): TPromise<void> {
|
||||
startup(): TPromise<void> {
|
||||
this.logService.debug('Starting VS Code');
|
||||
this.logService.debug(`from: ${this.environmentService.appRoot}`);
|
||||
this.logService.debug('args:', this.environmentService.args);
|
||||
|
||||
@@ -79,7 +79,7 @@ export class LaunchChannel implements ILaunchChannel {
|
||||
|
||||
constructor(private service: ILaunchService) { }
|
||||
|
||||
public call(command: string, arg: any): TPromise<any> {
|
||||
call(command: string, arg: any): TPromise<any> {
|
||||
switch (command) {
|
||||
case 'start':
|
||||
const { args, userEnv } = arg as IStartArguments;
|
||||
@@ -105,19 +105,19 @@ export class LaunchChannelClient implements ILaunchService {
|
||||
|
||||
constructor(private channel: ILaunchChannel) { }
|
||||
|
||||
public start(args: ParsedArgs, userEnv: IProcessEnvironment): TPromise<void> {
|
||||
start(args: ParsedArgs, userEnv: IProcessEnvironment): TPromise<void> {
|
||||
return this.channel.call('start', { args, userEnv });
|
||||
}
|
||||
|
||||
public getMainProcessId(): TPromise<number> {
|
||||
getMainProcessId(): TPromise<number> {
|
||||
return this.channel.call('get-main-process-id', null);
|
||||
}
|
||||
|
||||
public getMainProcessInfo(): TPromise<IMainProcessInfo> {
|
||||
getMainProcessInfo(): TPromise<IMainProcessInfo> {
|
||||
return this.channel.call('get-main-process-info', null);
|
||||
}
|
||||
|
||||
public getLogsPath(): TPromise<string> {
|
||||
getLogsPath(): TPromise<string> {
|
||||
return this.channel.call('get-logs-path', null);
|
||||
}
|
||||
}
|
||||
@@ -135,7 +135,7 @@ export class LaunchService implements ILaunchService {
|
||||
@IConfigurationService private readonly configurationService: IConfigurationService
|
||||
) { }
|
||||
|
||||
public start(args: ParsedArgs, userEnv: IProcessEnvironment): TPromise<void> {
|
||||
start(args: ParsedArgs, userEnv: IProcessEnvironment): TPromise<void> {
|
||||
this.logService.trace('Received data from other instance: ', args, userEnv);
|
||||
|
||||
const urlsToOpen = parseOpenUrl(args);
|
||||
@@ -237,13 +237,13 @@ export class LaunchService implements ILaunchService {
|
||||
return TPromise.as(null);
|
||||
}
|
||||
|
||||
public getMainProcessId(): TPromise<number> {
|
||||
getMainProcessId(): TPromise<number> {
|
||||
this.logService.trace('Received request for process ID from other instance.');
|
||||
|
||||
return TPromise.as(process.pid);
|
||||
}
|
||||
|
||||
public getMainProcessInfo(): TPromise<IMainProcessInfo> {
|
||||
getMainProcessInfo(): TPromise<IMainProcessInfo> {
|
||||
this.logService.trace('Received request for main process info from other instance.');
|
||||
|
||||
const windows: IWindowInfo[] = [];
|
||||
@@ -263,7 +263,7 @@ export class LaunchService implements ILaunchService {
|
||||
} as IMainProcessInfo);
|
||||
}
|
||||
|
||||
public getLogsPath(): TPromise<string> {
|
||||
getLogsPath(): TPromise<string> {
|
||||
this.logService.trace('Received request for logs path from other instance.');
|
||||
|
||||
return TPromise.as(this.environmentService.logsPath);
|
||||
|
||||
@@ -55,8 +55,8 @@ interface ITouchBarSegment extends Electron.SegmentedControlSegment {
|
||||
|
||||
export class CodeWindow implements ICodeWindow {
|
||||
|
||||
public static readonly themeStorageKey = 'theme';
|
||||
public static readonly themeBackgroundStorageKey = 'themeBackground';
|
||||
static readonly themeStorageKey = 'theme';
|
||||
static readonly themeBackgroundStorageKey = 'themeBackground';
|
||||
|
||||
private static readonly DEFAULT_BG_LIGHT = '#FFFFFF';
|
||||
private static readonly DEFAULT_BG_DARK = '#1E1E1E';
|
||||
@@ -229,35 +229,35 @@ export class CodeWindow implements ICodeWindow {
|
||||
this._lastFocusTime = Date.now(); // since we show directly, we need to set the last focus time too
|
||||
}
|
||||
|
||||
public hasHiddenTitleBarStyle(): boolean {
|
||||
hasHiddenTitleBarStyle(): boolean {
|
||||
return this.hiddenTitleBarStyle;
|
||||
}
|
||||
|
||||
public get isExtensionDevelopmentHost(): boolean {
|
||||
get isExtensionDevelopmentHost(): boolean {
|
||||
return !!this.config.extensionDevelopmentPath;
|
||||
}
|
||||
|
||||
public get isExtensionTestHost(): boolean {
|
||||
get isExtensionTestHost(): boolean {
|
||||
return !!this.config.extensionTestsPath;
|
||||
}
|
||||
|
||||
public get extensionDevelopmentPath(): string {
|
||||
get extensionDevelopmentPath(): string {
|
||||
return this.config.extensionDevelopmentPath;
|
||||
}
|
||||
|
||||
public get config(): IWindowConfiguration {
|
||||
get config(): IWindowConfiguration {
|
||||
return this.currentConfig;
|
||||
}
|
||||
|
||||
public get id(): number {
|
||||
get id(): number {
|
||||
return this._id;
|
||||
}
|
||||
|
||||
public get win(): Electron.BrowserWindow {
|
||||
get win(): Electron.BrowserWindow {
|
||||
return this._win;
|
||||
}
|
||||
|
||||
public setRepresentedFilename(filename: string): void {
|
||||
setRepresentedFilename(filename: string): void {
|
||||
if (isMacintosh) {
|
||||
this.win.setRepresentedFilename(filename);
|
||||
} else {
|
||||
@@ -265,7 +265,7 @@ export class CodeWindow implements ICodeWindow {
|
||||
}
|
||||
}
|
||||
|
||||
public getRepresentedFilename(): string {
|
||||
getRepresentedFilename(): string {
|
||||
if (isMacintosh) {
|
||||
return this.win.getRepresentedFilename();
|
||||
}
|
||||
@@ -273,7 +273,7 @@ export class CodeWindow implements ICodeWindow {
|
||||
return this.representedFilename;
|
||||
}
|
||||
|
||||
public focus(): void {
|
||||
focus(): void {
|
||||
if (!this._win) {
|
||||
return;
|
||||
}
|
||||
@@ -285,23 +285,23 @@ export class CodeWindow implements ICodeWindow {
|
||||
this._win.focus();
|
||||
}
|
||||
|
||||
public get lastFocusTime(): number {
|
||||
get lastFocusTime(): number {
|
||||
return this._lastFocusTime;
|
||||
}
|
||||
|
||||
public get backupPath(): string {
|
||||
get backupPath(): string {
|
||||
return this.currentConfig ? this.currentConfig.backupPath : void 0;
|
||||
}
|
||||
|
||||
public get openedWorkspace(): IWorkspaceIdentifier {
|
||||
get openedWorkspace(): IWorkspaceIdentifier {
|
||||
return this.currentConfig ? this.currentConfig.workspace : void 0;
|
||||
}
|
||||
|
||||
public get openedFolderPath(): string {
|
||||
get openedFolderPath(): string {
|
||||
return this.currentConfig ? this.currentConfig.folderPath : void 0;
|
||||
}
|
||||
|
||||
public setReady(): void {
|
||||
setReady(): void {
|
||||
this._readyState = ReadyState.READY;
|
||||
|
||||
// inform all waiting promises that we are ready now
|
||||
@@ -310,7 +310,7 @@ export class CodeWindow implements ICodeWindow {
|
||||
}
|
||||
}
|
||||
|
||||
public ready(): TPromise<ICodeWindow> {
|
||||
ready(): TPromise<ICodeWindow> {
|
||||
return new TPromise<ICodeWindow>((c) => {
|
||||
if (this._readyState === ReadyState.READY) {
|
||||
return c(this);
|
||||
@@ -321,7 +321,7 @@ export class CodeWindow implements ICodeWindow {
|
||||
});
|
||||
}
|
||||
|
||||
public get readyState(): ReadyState {
|
||||
get readyState(): ReadyState {
|
||||
return this._readyState;
|
||||
}
|
||||
|
||||
@@ -517,7 +517,7 @@ export class CodeWindow implements ICodeWindow {
|
||||
});
|
||||
}
|
||||
|
||||
public load(config: IWindowConfiguration, isReload?: boolean, disableExtensions?: boolean): void {
|
||||
load(config: IWindowConfiguration, isReload?: boolean, disableExtensions?: boolean): void {
|
||||
|
||||
// If this is the first time the window is loaded, we associate the paths
|
||||
// directly with the window because we assume the loading will just work
|
||||
@@ -574,7 +574,7 @@ export class CodeWindow implements ICodeWindow {
|
||||
}
|
||||
}
|
||||
|
||||
public reload(configuration?: IWindowConfiguration, cli?: ParsedArgs): void {
|
||||
reload(configuration?: IWindowConfiguration, cli?: ParsedArgs): void {
|
||||
|
||||
// If config is not provided, copy our current one
|
||||
if (!configuration) {
|
||||
@@ -678,7 +678,7 @@ export class CodeWindow implements ICodeWindow {
|
||||
return background;
|
||||
}
|
||||
|
||||
public serializeWindowState(): IWindowState {
|
||||
serializeWindowState(): IWindowState {
|
||||
if (!this._win) {
|
||||
return defaultWindowState();
|
||||
}
|
||||
@@ -834,14 +834,14 @@ export class CodeWindow implements ICodeWindow {
|
||||
return null;
|
||||
}
|
||||
|
||||
public getBounds(): Electron.Rectangle {
|
||||
getBounds(): Electron.Rectangle {
|
||||
const pos = this._win.getPosition();
|
||||
const dimension = this._win.getSize();
|
||||
|
||||
return { x: pos[0], y: pos[1], width: dimension[0], height: dimension[1] };
|
||||
}
|
||||
|
||||
public toggleFullScreen(): void {
|
||||
toggleFullScreen(): void {
|
||||
const willBeFullScreen = !this._win.isFullScreen();
|
||||
|
||||
// set fullscreen flag on window
|
||||
@@ -916,7 +916,7 @@ export class CodeWindow implements ICodeWindow {
|
||||
}
|
||||
}
|
||||
|
||||
public onWindowTitleDoubleClick(): void {
|
||||
onWindowTitleDoubleClick(): void {
|
||||
|
||||
// Respect system settings on mac with regards to title click on windows title
|
||||
if (isMacintosh) {
|
||||
@@ -943,25 +943,25 @@ export class CodeWindow implements ICodeWindow {
|
||||
}
|
||||
}
|
||||
|
||||
public close(): void {
|
||||
close(): void {
|
||||
if (this._win) {
|
||||
this._win.close();
|
||||
}
|
||||
}
|
||||
|
||||
public sendWhenReady(channel: string, ...args: any[]): void {
|
||||
sendWhenReady(channel: string, ...args: any[]): void {
|
||||
this.ready().then(() => {
|
||||
this.send(channel, ...args);
|
||||
});
|
||||
}
|
||||
|
||||
public send(channel: string, ...args: any[]): void {
|
||||
send(channel: string, ...args: any[]): void {
|
||||
if (this._win) {
|
||||
this._win.webContents.send(channel, ...args);
|
||||
}
|
||||
}
|
||||
|
||||
public updateTouchBar(groups: ISerializableCommandAction[][]): void {
|
||||
updateTouchBar(groups: ISerializableCommandAction[][]): void {
|
||||
if (!isMacintosh) {
|
||||
return; // only supported on macOS
|
||||
}
|
||||
@@ -1033,7 +1033,7 @@ export class CodeWindow implements ICodeWindow {
|
||||
return segments;
|
||||
}
|
||||
|
||||
public dispose(): void {
|
||||
dispose(): void {
|
||||
if (this.showTimeoutHandle) {
|
||||
clearTimeout(this.showTimeoutHandle);
|
||||
}
|
||||
|
||||
@@ -153,7 +153,7 @@ export class WindowsManager implements IWindowsMainService {
|
||||
this.workspacesManager = new WorkspacesManager(workspacesMainService, backupMainService, environmentService, this);
|
||||
}
|
||||
|
||||
public ready(initialUserEnv: IProcessEnvironment): void {
|
||||
ready(initialUserEnv: IProcessEnvironment): void {
|
||||
this.initialUserEnv = initialUserEnv;
|
||||
|
||||
this.registerListeners();
|
||||
@@ -323,7 +323,7 @@ export class WindowsManager implements IWindowsMainService {
|
||||
};
|
||||
}
|
||||
|
||||
public open(openConfig: IOpenConfiguration): ICodeWindow[] {
|
||||
open(openConfig: IOpenConfiguration): ICodeWindow[] {
|
||||
openConfig = this.validateOpenConfig(openConfig);
|
||||
|
||||
let pathsToOpen = this.getPathsToOpen(openConfig);
|
||||
@@ -1010,7 +1010,7 @@ export class WindowsManager implements IWindowsMainService {
|
||||
return { openFolderInNewWindow, openFilesInNewWindow };
|
||||
}
|
||||
|
||||
public openExtensionDevelopmentHostWindow(openConfig: IOpenConfiguration): void {
|
||||
openExtensionDevelopmentHostWindow(openConfig: IOpenConfiguration): void {
|
||||
|
||||
// Reload an existing extension development host window on the same path
|
||||
// We currently do not allow more than one extension development window
|
||||
@@ -1286,7 +1286,7 @@ export class WindowsManager implements IWindowsMainService {
|
||||
return state;
|
||||
}
|
||||
|
||||
public reload(win: ICodeWindow, cli?: ParsedArgs): void {
|
||||
reload(win: ICodeWindow, cli?: ParsedArgs): void {
|
||||
|
||||
// Only reload when the window has not vetoed this
|
||||
this.lifecycleService.unload(win, UnloadReason.RELOAD).done(veto => {
|
||||
@@ -1299,18 +1299,18 @@ export class WindowsManager implements IWindowsMainService {
|
||||
});
|
||||
}
|
||||
|
||||
public closeWorkspace(win: ICodeWindow): void {
|
||||
closeWorkspace(win: ICodeWindow): void {
|
||||
this.openInBrowserWindow({
|
||||
cli: this.environmentService.args,
|
||||
windowToUse: win
|
||||
});
|
||||
}
|
||||
|
||||
public saveAndEnterWorkspace(win: ICodeWindow, path: string): TPromise<IEnterWorkspaceResult> {
|
||||
saveAndEnterWorkspace(win: ICodeWindow, path: string): TPromise<IEnterWorkspaceResult> {
|
||||
return this.workspacesManager.saveAndEnterWorkspace(win, path).then(result => this.doEnterWorkspace(win, result));
|
||||
}
|
||||
|
||||
public createAndEnterWorkspace(win: ICodeWindow, folders?: IWorkspaceFolderCreationData[], path?: string): TPromise<IEnterWorkspaceResult> {
|
||||
createAndEnterWorkspace(win: ICodeWindow, folders?: IWorkspaceFolderCreationData[], path?: string): TPromise<IEnterWorkspaceResult> {
|
||||
return this.workspacesManager.createAndEnterWorkspace(win, folders, path).then(result => this.doEnterWorkspace(win, result));
|
||||
}
|
||||
|
||||
@@ -1325,7 +1325,7 @@ export class WindowsManager implements IWindowsMainService {
|
||||
return result;
|
||||
}
|
||||
|
||||
public pickWorkspaceAndOpen(options: INativeOpenDialogOptions): void {
|
||||
pickWorkspaceAndOpen(options: INativeOpenDialogOptions): void {
|
||||
this.workspacesManager.pickWorkspaceAndOpen(options);
|
||||
}
|
||||
|
||||
@@ -1366,7 +1366,7 @@ export class WindowsManager implements IWindowsMainService {
|
||||
}));
|
||||
}
|
||||
|
||||
public focusLastActive(cli: ParsedArgs, context: OpenContext): ICodeWindow {
|
||||
focusLastActive(cli: ParsedArgs, context: OpenContext): ICodeWindow {
|
||||
const lastActive = this.getLastActiveWindow();
|
||||
if (lastActive) {
|
||||
lastActive.focus();
|
||||
@@ -1378,15 +1378,15 @@ export class WindowsManager implements IWindowsMainService {
|
||||
return this.open({ context, cli, forceEmpty: true })[0];
|
||||
}
|
||||
|
||||
public getLastActiveWindow(): ICodeWindow {
|
||||
getLastActiveWindow(): ICodeWindow {
|
||||
return getLastActiveWindow(WindowsManager.WINDOWS);
|
||||
}
|
||||
|
||||
public openNewWindow(context: OpenContext): ICodeWindow[] {
|
||||
openNewWindow(context: OpenContext): ICodeWindow[] {
|
||||
return this.open({ context, cli: this.environmentService.args, forceNewWindow: true, forceEmpty: true });
|
||||
}
|
||||
|
||||
public waitForWindowCloseOrLoad(windowId: number): TPromise<void> {
|
||||
waitForWindowCloseOrLoad(windowId: number): TPromise<void> {
|
||||
return new TPromise<void>(c => {
|
||||
function handler(id: number) {
|
||||
if (id === windowId) {
|
||||
@@ -1402,7 +1402,7 @@ export class WindowsManager implements IWindowsMainService {
|
||||
});
|
||||
}
|
||||
|
||||
public sendToFocused(channel: string, ...args: any[]): void {
|
||||
sendToFocused(channel: string, ...args: any[]): void {
|
||||
const focusedWindow = this.getFocusedWindow() || this.getLastActiveWindow();
|
||||
|
||||
if (focusedWindow) {
|
||||
@@ -1410,7 +1410,7 @@ export class WindowsManager implements IWindowsMainService {
|
||||
}
|
||||
}
|
||||
|
||||
public sendToAll(channel: string, payload?: any, windowIdsToIgnore?: number[]): void {
|
||||
sendToAll(channel: string, payload?: any, windowIdsToIgnore?: number[]): void {
|
||||
WindowsManager.WINDOWS.forEach(w => {
|
||||
if (windowIdsToIgnore && windowIdsToIgnore.indexOf(w.id) >= 0) {
|
||||
return; // do not send if we are instructed to ignore it
|
||||
@@ -1420,7 +1420,7 @@ export class WindowsManager implements IWindowsMainService {
|
||||
});
|
||||
}
|
||||
|
||||
public getFocusedWindow(): ICodeWindow {
|
||||
getFocusedWindow(): ICodeWindow {
|
||||
const win = BrowserWindow.getFocusedWindow();
|
||||
if (win) {
|
||||
return this.getWindowById(win.id);
|
||||
@@ -1429,7 +1429,7 @@ export class WindowsManager implements IWindowsMainService {
|
||||
return null;
|
||||
}
|
||||
|
||||
public getWindowById(windowId: number): ICodeWindow {
|
||||
getWindowById(windowId: number): ICodeWindow {
|
||||
const res = WindowsManager.WINDOWS.filter(w => w.id === windowId);
|
||||
if (res && res.length === 1) {
|
||||
return res[0];
|
||||
@@ -1438,11 +1438,11 @@ export class WindowsManager implements IWindowsMainService {
|
||||
return null;
|
||||
}
|
||||
|
||||
public getWindows(): ICodeWindow[] {
|
||||
getWindows(): ICodeWindow[] {
|
||||
return WindowsManager.WINDOWS;
|
||||
}
|
||||
|
||||
public getWindowCount(): number {
|
||||
getWindowCount(): number {
|
||||
return WindowsManager.WINDOWS.length;
|
||||
}
|
||||
|
||||
@@ -1510,15 +1510,15 @@ export class WindowsManager implements IWindowsMainService {
|
||||
this._onWindowClose.fire(win.id);
|
||||
}
|
||||
|
||||
public pickFileFolderAndOpen(options: INativeOpenDialogOptions): void {
|
||||
pickFileFolderAndOpen(options: INativeOpenDialogOptions): void {
|
||||
this.doPickAndOpen(options, true /* pick folders */, true /* pick files */);
|
||||
}
|
||||
|
||||
public pickFolderAndOpen(options: INativeOpenDialogOptions): void {
|
||||
pickFolderAndOpen(options: INativeOpenDialogOptions): void {
|
||||
this.doPickAndOpen(options, true /* pick folders */, false /* pick files */);
|
||||
}
|
||||
|
||||
public pickFileAndOpen(options: INativeOpenDialogOptions): void {
|
||||
pickFileAndOpen(options: INativeOpenDialogOptions): void {
|
||||
this.doPickAndOpen(options, false /* pick folders */, true /* pick files */);
|
||||
}
|
||||
|
||||
@@ -1556,19 +1556,19 @@ export class WindowsManager implements IWindowsMainService {
|
||||
this.dialogs.pickAndOpen(internalOptions);
|
||||
}
|
||||
|
||||
public showMessageBox(options: Electron.MessageBoxOptions, win?: ICodeWindow): TPromise<IMessageBoxResult> {
|
||||
showMessageBox(options: Electron.MessageBoxOptions, win?: ICodeWindow): TPromise<IMessageBoxResult> {
|
||||
return this.dialogs.showMessageBox(options, win);
|
||||
}
|
||||
|
||||
public showSaveDialog(options: Electron.SaveDialogOptions, win?: ICodeWindow): TPromise<string> {
|
||||
showSaveDialog(options: Electron.SaveDialogOptions, win?: ICodeWindow): TPromise<string> {
|
||||
return this.dialogs.showSaveDialog(options, win);
|
||||
}
|
||||
|
||||
public showOpenDialog(options: Electron.OpenDialogOptions, win?: ICodeWindow): TPromise<string[]> {
|
||||
showOpenDialog(options: Electron.OpenDialogOptions, win?: ICodeWindow): TPromise<string[]> {
|
||||
return this.dialogs.showOpenDialog(options, win);
|
||||
}
|
||||
|
||||
public quit(): void {
|
||||
quit(): void {
|
||||
|
||||
// If the user selected to exit from an extension development host window, do not quit, but just
|
||||
// close the window unless this is the last window that is opened.
|
||||
@@ -1608,7 +1608,7 @@ class Dialogs {
|
||||
this.noWindowDialogQueue = new Queue<any>();
|
||||
}
|
||||
|
||||
public pickAndOpen(options: INativeOpenDialogOptions): void {
|
||||
pickAndOpen(options: INativeOpenDialogOptions): void {
|
||||
this.getFileOrFolderPaths(options).then(paths => {
|
||||
const numberOfPaths = paths ? paths.length : 0;
|
||||
|
||||
@@ -1694,7 +1694,7 @@ class Dialogs {
|
||||
return windowDialogQueue;
|
||||
}
|
||||
|
||||
public showMessageBox(options: Electron.MessageBoxOptions, window?: ICodeWindow): TPromise<IMessageBoxResult> {
|
||||
showMessageBox(options: Electron.MessageBoxOptions, window?: ICodeWindow): TPromise<IMessageBoxResult> {
|
||||
return this.getDialogQueue(window).queue(() => {
|
||||
return new TPromise((c, e) => {
|
||||
dialog.showMessageBox(window ? window.win : void 0, options, (response: number, checkboxChecked: boolean) => {
|
||||
@@ -1704,7 +1704,7 @@ class Dialogs {
|
||||
});
|
||||
}
|
||||
|
||||
public showSaveDialog(options: Electron.SaveDialogOptions, window?: ICodeWindow): TPromise<string> {
|
||||
showSaveDialog(options: Electron.SaveDialogOptions, window?: ICodeWindow): TPromise<string> {
|
||||
|
||||
function normalizePath(path: string): string {
|
||||
if (path && isMacintosh) {
|
||||
@@ -1723,7 +1723,7 @@ class Dialogs {
|
||||
});
|
||||
}
|
||||
|
||||
public showOpenDialog(options: Electron.OpenDialogOptions, window?: ICodeWindow): TPromise<string[]> {
|
||||
showOpenDialog(options: Electron.OpenDialogOptions, window?: ICodeWindow): TPromise<string[]> {
|
||||
|
||||
function normalizePaths(paths: string[]): string[] {
|
||||
if (paths && paths.length > 0 && isMacintosh) {
|
||||
@@ -1767,7 +1767,7 @@ class WorkspacesManager {
|
||||
) {
|
||||
}
|
||||
|
||||
public saveAndEnterWorkspace(window: ICodeWindow, path: string): TPromise<IEnterWorkspaceResult> {
|
||||
saveAndEnterWorkspace(window: ICodeWindow, path: string): TPromise<IEnterWorkspaceResult> {
|
||||
if (!window || !window.win || window.readyState !== ReadyState.READY || !window.openedWorkspace || !path || !this.isValidTargetWorkspacePath(window, path)) {
|
||||
return TPromise.as(null); // return early if the window is not ready or disposed or does not have a workspace
|
||||
}
|
||||
@@ -1775,7 +1775,7 @@ class WorkspacesManager {
|
||||
return this.doSaveAndOpenWorkspace(window, window.openedWorkspace, path);
|
||||
}
|
||||
|
||||
public createAndEnterWorkspace(window: ICodeWindow, folders?: IWorkspaceFolderCreationData[], path?: string): TPromise<IEnterWorkspaceResult> {
|
||||
createAndEnterWorkspace(window: ICodeWindow, folders?: IWorkspaceFolderCreationData[], path?: string): TPromise<IEnterWorkspaceResult> {
|
||||
if (!window || !window.win || window.readyState !== ReadyState.READY) {
|
||||
return TPromise.as(null); // return early if the window is not ready or disposed
|
||||
}
|
||||
@@ -1844,7 +1844,7 @@ class WorkspacesManager {
|
||||
});
|
||||
}
|
||||
|
||||
public pickWorkspaceAndOpen(options: INativeOpenDialogOptions): void {
|
||||
pickWorkspaceAndOpen(options: INativeOpenDialogOptions): void {
|
||||
const window = this.windowsMainService.getWindowById(options.windowId) || this.windowsMainService.getFocusedWindow() || this.windowsMainService.getLastActiveWindow();
|
||||
|
||||
this.windowsMainService.pickFileAndOpen({
|
||||
@@ -1862,7 +1862,7 @@ class WorkspacesManager {
|
||||
});
|
||||
}
|
||||
|
||||
public promptToSaveUntitledWorkspace(window: ICodeWindow, workspace: IWorkspaceIdentifier): TPromise<boolean> {
|
||||
promptToSaveUntitledWorkspace(window: ICodeWindow, workspace: IWorkspaceIdentifier): TPromise<boolean> {
|
||||
enum ConfirmResult {
|
||||
SAVE,
|
||||
DONT_SAVE,
|
||||
|
||||
Reference in New Issue
Block a user