Johannes Rieken 2021-06-07 15:32:03 +02:00
parent 229f018be9
commit 3d377570fa
No known key found for this signature in database
GPG key ID: 96634B5AF12F8798

View file

@ -299,13 +299,21 @@ export class OutlinePane extends ViewPane {
if (!this._outlineViewState.followCursor || !newOutline.activeElement) {
return;
}
const item = newOutline.activeElement;
const top = tree.getRelativeTop(item);
if (top === null) {
tree.reveal(item, 0.5);
let item = newOutline.activeElement;
while (item) {
const top = tree.getRelativeTop(item);
if (top === null) {
// not visible -> reveal
tree.reveal(item, 0.5);
}
if (tree.getRelativeTop(item) !== null) {
tree.setFocus([item]);
tree.setSelection([item]);
break;
}
// STILL not visible -> try parent
item = tree.getParentElement(item);
}
tree.setFocus([item]);
tree.setSelection([item]);
};
revealActiveElement();
this._editorDisposables.add(newOutline.onDidChange(revealActiveElement));