Skip to content

Commit 210675f

Browse files
committed
fix selection
1 parent c5a7852 commit 210675f

3 files changed

Lines changed: 9 additions & 1 deletion

File tree

src/vs/workbench/contrib/customEditor/browser/customEditorOutline.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,7 @@ class CustomEditorExtensionOutline implements IOutline<CustomEditorOutlineEntry>
291291
getActionsContext: (entry: CustomEditorOutlineEntry) => {
292292
return { id: entry.id };
293293
},
294+
alwaysRevealActiveElement: true,
294295
};
295296

296297
// Listen for outline data changes from the extension provider

src/vs/workbench/contrib/outline/browser/outlinePane.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ export class OutlinePane extends ViewPane implements IOutlinePane {
348348
}));
349349
// feature: reveal editor selection in outline
350350
const revealActiveElement = () => {
351-
if (!this._outlineViewState.followCursor || !newOutline.activeElement) {
351+
if (!(this._outlineViewState.followCursor || newOutline.config.alwaysRevealActiveElement) || !newOutline.activeElement) {
352352
return;
353353
}
354354
let item = newOutline.activeElement;

src/vs/workbench/services/outline/browser/outline.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,13 @@ export interface IOutlineListConfig<E> {
7676
readonly contextMenuId?: MenuId;
7777
readonly getContextKeyOverlay?: (element: E) => [string, ContextKeyValue][];
7878
readonly getActionsContext?: (element: E) => unknown;
79+
/**
80+
* When true, the outline pane always reveals the active element regardless
81+
* of the "follow cursor" setting. Useful for custom editors where the
82+
* extension explicitly sets the active item rather than deriving it from
83+
* cursor position.
84+
*/
85+
readonly alwaysRevealActiveElement?: boolean;
7986
}
8087

8188
export interface OutlineChangeEvent {

0 commit comments

Comments
 (0)