提交 73fb8872 编写于 作者: B Benjamin Pasero

grid - simplify active editor event handling

上级 1d895792
...@@ -61,7 +61,6 @@ export class NextEditorService extends Disposable implements INextEditorService ...@@ -61,7 +61,6 @@ export class NextEditorService extends Disposable implements INextEditorService
private fileInputFactory: IFileInputFactory; private fileInputFactory: IFileInputFactory;
private lastActiveEditor: IEditorInput; private lastActiveEditor: IEditorInput;
private lastActiveGroup: INextEditorGroup;
constructor( constructor(
@INextEditorGroupsService private nextEditorGroupsService: INextEditorGroupsService, @INextEditorGroupsService private nextEditorGroupsService: INextEditorGroupsService,
...@@ -83,19 +82,15 @@ export class NextEditorService extends Disposable implements INextEditorService ...@@ -83,19 +82,15 @@ export class NextEditorService extends Disposable implements INextEditorService
} }
private registerListeners(): void { private registerListeners(): void {
this.nextEditorGroupsService.onDidActiveGroupChange(group => this.onDidActiveGroupChange(group)); this.nextEditorGroupsService.onDidActiveGroupChange(group => this.handleActiveEditorChange(group));
this.nextEditorGroupsService.onDidAddGroup(group => this.onDidAddGroup(group)); this.nextEditorGroupsService.onDidAddGroup(group => this.onDidAddGroup(group));
} }
private onDidActiveGroupChange(group: INextEditorGroup): void { private handleActiveEditorChange(group: INextEditorGroup): void {
if (!this.lastActiveGroup) { if (group !== this.nextEditorGroupsService.activeGroup) {
this.lastActiveGroup = group; return; // ignore if not the active group
return; // ignore the initial root group
} }
this.lastActiveGroup = group;
if (!this.lastActiveEditor && !group.activeEditor) { if (!this.lastActiveEditor && !group.activeEditor) {
return; // ignore if we still have no active editor return; // ignore if we still have no active editor
} }
...@@ -109,10 +104,7 @@ export class NextEditorService extends Disposable implements INextEditorService ...@@ -109,10 +104,7 @@ export class NextEditorService extends Disposable implements INextEditorService
const groupDisposeables: IDisposable[] = []; const groupDisposeables: IDisposable[] = [];
groupDisposeables.push(group.onDidActiveEditorChange(() => { groupDisposeables.push(group.onDidActiveEditorChange(() => {
if (group === this.nextEditorGroupsService.activeGroup) { this.handleActiveEditorChange(group);
this._onDidActiveEditorChange.fire();
}
this._onDidVisibleEditorsChange.fire(); this._onDidVisibleEditorsChange.fire();
})); }));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册