提交 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';
export class SidebarPart extends Part implements IViewletService {
public static activeViewletSettingsKey = 'workbench.sidebar.activeviewletid';
public serviceId = IViewletService;
private instantiationService: IInstantiationService;
......@@ -234,6 +236,9 @@ export class SidebarPart extends Part implements IViewletService {
// Remember Viewlet
this.activeViewlet = viewlet;
// Store in preferences
this.storageService.store(SidebarPart.activeViewletSettingsKey, this.activeViewlet.getId(), StorageScope.WORKSPACE);
// Remember
this.lastActiveViewletId = this.activeViewlet.getId();
......
......@@ -199,9 +199,14 @@ export class Workbench implements IPartService {
// Show default viewlet unless sidebar is hidden or we dont have a default viewlet
let registry = (<IViewletRegistry>Registry.as(ViewletExtensions.Viewlets));
if (!this.sideBarHidden && !!registry.getDefaultViewletId()) {
let viewletTimerEvent = timer.start(timer.Topic.STARTUP, strings.format('Opening Viewlet: {0}', registry.getDefaultViewletId()));
viewletAndEditorPromises.push(this.sidebarPart.openViewlet(registry.getDefaultViewletId(), false).then(() => viewletTimerEvent.stop()));
let viewletId = registry.getDefaultViewletId();
if (!this.workbenchParams.configuration.env.isBuilt) {
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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册