Skip to content

Commit

Permalink
Remember all UI state even for empty windows (fixes #207) (#28580)
Browse files Browse the repository at this point in the history
  • Loading branch information
bpasero authored Jun 13, 2017
1 parent 60a0695 commit 03bb0ad
Show file tree
Hide file tree
Showing 29 changed files with 416 additions and 209 deletions.
2 changes: 1 addition & 1 deletion src/vs/code/electron-main/launch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ export class LaunchService implements ILaunchService {

// If the other instance is waiting to be killed, we hook up a window listener if one window
// is being used and only then resolve the startup promise which will kill this second instance
if (args.wait && usedWindows && usedWindows.length === 1 && usedWindows[0]) {
if (args.wait && usedWindows.length === 1 && usedWindows[0]) {
const windowId = usedWindows[0].id;

return new TPromise<void>((c, e) => {
Expand Down
2 changes: 1 addition & 1 deletion src/vs/code/electron-main/menus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ export class CodeMenu {
return new MenuItem(this.likeAction(commandId, {
label: this.unmnemonicLabel(tildify(path, this.environmentService.userHome)), click: (menuItem, win, event) => {
const openInNewWindow = this.isOptionClick(event);
const success = !!this.windowsService.open({ context: OpenContext.MENU, cli: this.environmentService.args, pathsToOpen: [path], forceNewWindow: openInNewWindow });
const success = this.windowsService.open({ context: OpenContext.MENU, cli: this.environmentService.args, pathsToOpen: [path], forceNewWindow: openInNewWindow }).length > 0;
if (!success) {
this.historyService.removeFromRecentPathsList(path);
}
Expand Down
8 changes: 6 additions & 2 deletions src/vs/code/electron-main/window.ts
Original file line number Diff line number Diff line change
Expand Up @@ -271,11 +271,15 @@ export class CodeWindow implements ICodeWindow {
}

public get openedWorkspacePath(): string {
return this.currentConfig.workspacePath;
return this.currentConfig ? this.currentConfig.workspacePath : void 0;
}

public get backupPath(): string {
return this.currentConfig ? this.currentConfig.backupPath : void 0;
}

public get openedFilePath(): string {
return this.currentConfig.filesToOpen && this.currentConfig.filesToOpen[0] && this.currentConfig.filesToOpen[0].filePath;
return this.currentConfig && this.currentConfig.filesToOpen && this.currentConfig.filesToOpen[0] && this.currentConfig.filesToOpen[0].filePath;
}

public setReady(): void {
Expand Down
Loading

0 comments on commit 03bb0ad

Please sign in to comment.