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

dev: restore last active viewlet to speed up dev flow

上级 b0fe390f
...@@ -44,6 +44,8 @@ import {KeyMod, KeyCode} from 'vs/base/common/keyCodes'; ...@@ -44,6 +44,8 @@ import {KeyMod, KeyCode} from 'vs/base/common/keyCodes';
export class SidebarPart extends Part implements IViewletService { export class SidebarPart extends Part implements IViewletService {
public static activeViewletSettingsKey = 'workbench.sidebar.activeviewletid';
public serviceId = IViewletService; public serviceId = IViewletService;
private instantiationService: IInstantiationService; private instantiationService: IInstantiationService;
...@@ -234,6 +236,9 @@ export class SidebarPart extends Part implements IViewletService { ...@@ -234,6 +236,9 @@ export class SidebarPart extends Part implements IViewletService {
// Remember Viewlet // Remember Viewlet
this.activeViewlet = viewlet; this.activeViewlet = viewlet;
// Store in preferences
this.storageService.store(SidebarPart.activeViewletSettingsKey, this.activeViewlet.getId(), StorageScope.WORKSPACE);
// Remember // Remember
this.lastActiveViewletId = this.activeViewlet.getId(); this.lastActiveViewletId = this.activeViewlet.getId();
......
...@@ -199,9 +199,14 @@ export class Workbench implements IPartService { ...@@ -199,9 +199,14 @@ export class Workbench implements IPartService {
// Show default viewlet unless sidebar is hidden or we dont have a default viewlet // Show default viewlet unless sidebar is hidden or we dont have a default viewlet
let registry = (<IViewletRegistry>Registry.as(ViewletExtensions.Viewlets)); let registry = (<IViewletRegistry>Registry.as(ViewletExtensions.Viewlets));
if (!this.sideBarHidden && !!registry.getDefaultViewletId()) { let viewletId = registry.getDefaultViewletId();
let viewletTimerEvent = timer.start(timer.Topic.STARTUP, strings.format('Opening Viewlet: {0}', registry.getDefaultViewletId())); if (!this.workbenchParams.configuration.env.isBuilt) {
viewletAndEditorPromises.push(this.sidebarPart.openViewlet(registry.getDefaultViewletId(), false).then(() => viewletTimerEvent.stop())); viewletId = this.storageService.get(SidebarPart.activeViewletSettingsKey, StorageScope.WORKSPACE, registry.getDefaultViewletId()); // help developers and restore last view
}
if (!this.sideBarHidden && !!viewletId) {
let viewletTimerEvent = timer.start(timer.Topic.STARTUP, strings.format('Opening Viewlet: {0}', viewletId));
viewletAndEditorPromises.push(this.sidebarPart.openViewlet(viewletId, false).then(() => viewletTimerEvent.stop()));
} }
// Check for configured options to open files on startup and resolve if any or open untitled for empty workbench // Check for configured options to open files on startup and resolve if any or open untitled for empty workbench
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册