src/vs/workbench/services/history/browser/historyService.ts/HistoryService/onDidActiveEditorChange
class HistoryService:	private onDidActiveEditorChange(): void {
		const activeEditorGroup = this.editorGroupService.activeGroup;
		const activeEditorPane = activeEditorGroup.activeEditorPane;
		if (this.lastActiveEditor && this.editorHelper.matchesEditorIdentifier(this.lastActiveEditor, activeEditorPane)) {
			return; // return if the active editor is still the same
		}

		// Remember as last active editor (can be undefined if none opened)
		this.lastActiveEditor = activeEditorPane?.input && activeEditorPane.group ? { editor: activeEditorPane.input, groupId: activeEditorPane.group.id } : undefined;

		// Dispose old listeners
		this.activeEditorListeners.clear();

		// Handle editor change
		this.handleActiveEditorChange(activeEditorGroup, activeEditorPane);

		// Listen to selection changes if the editor pane
		// is having a selection concept. We use `accumulate`
		// on the event to reduce the pressure on the editor
		// to reduce input latency.

		if (isEditorPaneWithSelection(activeEditorPane)) {
			this.activeEditorListeners.add(Event.accumulate(activeEditorPane.onDidChangeSelection)(e => this.handleActiveEditorSelectionChangeEvents(activeEditorGroup, activeEditorPane, e)));
		}

		// Context keys
		this.updateContextKeys();
	}