This commit is contained in:
parent
229f018be9
commit
3d377570fa
1 changed files with 14 additions and 6 deletions
|
@ -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));
|
||||
|
|
Loading…
Reference in a new issue