mirror of
https://github.com/Microsoft/vscode
synced 2024-09-19 02:26:04 +00:00
debt - better restore empty workspaces
This commit is contained in:
parent
93ea9d1ca9
commit
f3fa86d0a5
|
@ -1031,6 +1031,10 @@ export class EditorPart extends Part implements IEditorPart, IEditorGroupService
|
|||
return this.doOpenEditors(editors, activePosition, ratio);
|
||||
}
|
||||
|
||||
public hasEditorsToRestore(): boolean {
|
||||
return this.stacks.groups.some(g => g.count > 0);
|
||||
}
|
||||
|
||||
public restoreEditors(): TPromise<BaseEditor[]> {
|
||||
const editors = this.stacks.groups.map((group, index) => {
|
||||
return {
|
||||
|
|
|
@ -692,7 +692,7 @@ export abstract class BaseOpenRecentAction extends Action {
|
|||
const hasWorkspace = this.contextService.hasWorkspace();
|
||||
|
||||
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)"),
|
||||
matchOnDescription: true,
|
||||
quickNavigateConfiguration: this.isQuickNavigate() ? { keybindings: this.keybindingService.lookupKeybindings(this.id) } : void 0
|
||||
|
|
|
@ -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
|
||||
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 => {
|
||||
if (hasBackups) {
|
||||
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 {
|
|||
private initSettings(): void {
|
||||
|
||||
// Sidebar visibility
|
||||
this.sideBarHidden = this.storageService.getBoolean(Workbench.sidebarHiddenSettingKey, StorageScope.WORKSPACE, false);
|
||||
if (!this.contextService.hasWorkspace()) {
|
||||
this.sideBarHidden = true; // we hide sidebar in single-file-mode
|
||||
}
|
||||
this.sideBarHidden = this.storageService.getBoolean(Workbench.sidebarHiddenSettingKey, StorageScope.WORKSPACE, !this.contextService.hasWorkspace());
|
||||
|
||||
// Panel part visibility
|
||||
const panelRegistry = Registry.as<PanelRegistry>(PanelExtensions.Panels);
|
||||
this.panelHidden = this.storageService.getBoolean(Workbench.panelHiddenSettingKey, StorageScope.WORKSPACE, true);
|
||||
if (!this.contextService.hasWorkspace() || !panelRegistry.getDefaultPanelId()) {
|
||||
this.panelHidden = true; // we hide panel part in single-file-mode or if there is no default panel
|
||||
this.panelHidden = this.storageService.getBoolean(Workbench.panelHiddenSettingKey, StorageScope.WORKSPACE, !this.contextService.hasWorkspace());
|
||||
if (!panelRegistry.getDefaultPanelId()) {
|
||||
this.panelHidden = true; // we hide panel part if there is no default panel
|
||||
}
|
||||
|
||||
// Sidebar position
|
||||
|
|
Loading…
Reference in a new issue