提交 f3fa86d0 编写于 作者: B Benjamin Pasero

debt - better restore empty workspaces

上级 93ea9d1c
...@@ -1031,6 +1031,10 @@ export class EditorPart extends Part implements IEditorPart, IEditorGroupService ...@@ -1031,6 +1031,10 @@ export class EditorPart extends Part implements IEditorPart, IEditorGroupService
return this.doOpenEditors(editors, activePosition, ratio); return this.doOpenEditors(editors, activePosition, ratio);
} }
public hasEditorsToRestore(): boolean {
return this.stacks.groups.some(g => g.count > 0);
}
public restoreEditors(): TPromise<BaseEditor[]> { public restoreEditors(): TPromise<BaseEditor[]> {
const editors = this.stacks.groups.map((group, index) => { const editors = this.stacks.groups.map((group, index) => {
return { return {
......
...@@ -692,7 +692,7 @@ export abstract class BaseOpenRecentAction extends Action { ...@@ -692,7 +692,7 @@ export abstract class BaseOpenRecentAction extends Action {
const hasWorkspace = this.contextService.hasWorkspace(); const hasWorkspace = this.contextService.hasWorkspace();
this.quickOpenService.pick(folderPicks.concat(...filePicks), { this.quickOpenService.pick(folderPicks.concat(...filePicks), {
autoFocus: { autoFocusFirstEntry: !hasWorkspace && !this.isQuickNavigate(), autoFocusSecondEntry: hasWorkspace || this.isQuickNavigate() }, autoFocus: { autoFocusFirstEntry: !hasWorkspace, autoFocusSecondEntry: hasWorkspace },
placeHolder: isMacintosh ? nls.localize('openRecentPlaceHolderMac', "Select a path (hold Cmd-key to open in new window)") : nls.localize('openRecentPlaceHolder', "Select a path to open (hold Ctrl-key to open in new window)"), placeHolder: isMacintosh ? nls.localize('openRecentPlaceHolderMac', "Select a path (hold Cmd-key to open in new window)") : nls.localize('openRecentPlaceHolder', "Select a path to open (hold Ctrl-key to open in new window)"),
matchOnDescription: true, matchOnDescription: true,
quickNavigateConfiguration: this.isQuickNavigate() ? { keybindings: this.keybindingService.lookupKeybindings(this.id) } : void 0 quickNavigateConfiguration: this.isQuickNavigate() ? { keybindings: this.keybindingService.lookupKeybindings(this.id) } : void 0
......
...@@ -426,6 +426,10 @@ export class Workbench implements IPartService { ...@@ -426,6 +426,10 @@ export class Workbench implements IPartService {
// Empty workbench: some first time users will not have an untiled file; returning users will always have one // Empty workbench: some first time users will not have an untiled file; returning users will always have one
else if (!this.contextService.hasWorkspace() && this.telemetryService.getExperiments().openUntitledFile && !this.configurationService.lookup('workbench.welcome.enabled').value) { else if (!this.contextService.hasWorkspace() && this.telemetryService.getExperiments().openUntitledFile && !this.configurationService.lookup('workbench.welcome.enabled').value) {
if (this.editorPart.hasEditorsToRestore()) {
return TPromise.as([]); // do not open any empty untitled file if we have editors to restore
}
return this.backupFileService.hasBackups().then(hasBackups => { return this.backupFileService.hasBackups().then(hasBackups => {
if (hasBackups) { if (hasBackups) {
return TPromise.as([]); // do not open any empty untitled file if we have backups to restore return TPromise.as([]); // do not open any empty untitled file if we have backups to restore
...@@ -562,16 +566,13 @@ export class Workbench implements IPartService { ...@@ -562,16 +566,13 @@ export class Workbench implements IPartService {
private initSettings(): void { private initSettings(): void {
// Sidebar visibility // Sidebar visibility
this.sideBarHidden = this.storageService.getBoolean(Workbench.sidebarHiddenSettingKey, StorageScope.WORKSPACE, false); this.sideBarHidden = this.storageService.getBoolean(Workbench.sidebarHiddenSettingKey, StorageScope.WORKSPACE, !this.contextService.hasWorkspace());
if (!this.contextService.hasWorkspace()) {
this.sideBarHidden = true; // we hide sidebar in single-file-mode
}
// Panel part visibility // Panel part visibility
const panelRegistry = Registry.as<PanelRegistry>(PanelExtensions.Panels); const panelRegistry = Registry.as<PanelRegistry>(PanelExtensions.Panels);
this.panelHidden = this.storageService.getBoolean(Workbench.panelHiddenSettingKey, StorageScope.WORKSPACE, true); this.panelHidden = this.storageService.getBoolean(Workbench.panelHiddenSettingKey, StorageScope.WORKSPACE, !this.contextService.hasWorkspace());
if (!this.contextService.hasWorkspace() || !panelRegistry.getDefaultPanelId()) { if (!panelRegistry.getDefaultPanelId()) {
this.panelHidden = true; // we hide panel part in single-file-mode or if there is no default panel this.panelHidden = true; // we hide panel part if there is no default panel
} }
// Sidebar position // Sidebar position
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册