Given the following two event listeners on a WorkbenchAsyncDataTree:
this._register(this.tree.onDidChangeSelection(e => {
if (e.elements !== this.lastSelection) {
this.lastSelection = e.elements;
this.lastActive = this.tree?.getFocus()[0] ?? this.lastActive;
this._onDidChangeSelectionAndFocus.fire({ selection: this.lastSelection, focus: this.lastActive });
}
}));
this._register(this.tree.onDidChangeFocus(e => {
if (e.elements.length && (e.elements[0] !== this.lastActive)) {
this.lastActive = e.elements[0];
this.lastSelection = this.tree?.getSelection() ?? this.lastSelection;
this._onDidChangeSelectionAndFocus.fire({ selection: this.lastSelection, focus: this.lastActive });
}
}));
I would expect that when the onDidChangeSelection event fires, that the value of getFocus has already been updated.
I would also expect that when the onDidChangeFocus event fires, that the value of getSelection() has already been updated.
This came out of the API discussion for #184268.
Given the following two event listeners on a
WorkbenchAsyncDataTree:I would expect that when the
onDidChangeSelectionevent fires, that the value ofgetFocushas already been updated.I would also expect that when the
onDidChangeFocusevent fires, that the value ofgetSelection()has already been updated.This came out of the API discussion for #184268.