@@ -75,6 +75,7 @@ class CustomEditorOutlineRenderer implements ITreeRenderer<CustomEditorOutlineEn
7575 @IContextKeyService private readonly _contextKeyService : IContextKeyService ,
7676 @IMenuService private readonly _menuService : IMenuService ,
7777 @IInstantiationService private readonly _instantiationService : IInstantiationService ,
78+ @IConfigurationService private readonly _configurationService : IConfigurationService ,
7879 ) { }
7980
8081 renderTemplate ( container : HTMLElement ) : ICustomEditorOutlineTemplate {
@@ -98,10 +99,13 @@ class CustomEditorOutlineRenderer implements ITreeRenderer<CustomEditorOutlineEn
9899
99100 template . iconClass . className = '' ;
100101 template . iconClass . classList . add ( 'outline-element-icon' , 'inline' ) ;
101- if ( entry . icon ) {
102+ if ( entry . icon && this . _configurationService . getValue < boolean > ( OutlineConfigKeys . icons ) ) {
102103 template . iconClass . classList . add ( 'codicon-colored' , ...ThemeIcon . asClassNameArray ( entry . icon ) ) ;
103104 }
104105
106+ if ( entry . tooltip ) {
107+ options . title = entry . tooltip ;
108+ }
105109 template . iconLabel . setLabel ( entry . label , entry . detail , options ) ;
106110
107111 if ( this . _target === OutlineTarget . OutlinePane ) {
@@ -118,11 +122,12 @@ class CustomEditorOutlineRenderer implements ITreeRenderer<CustomEditorOutlineEn
118122 } ) ) ;
119123
120124 const menu = template . elementDisposables . add ( this . _menuService . createMenu ( MenuId . CustomEditorOutlineActionMenu , scopedContextKeyService ) ) ;
121- const actions = getActionBarActions ( menu . getActions ( { shouldForwardArgs : true } ) , g => / ^ i n l i n e / . test ( g ) ) ;
125+ const menuArg = { id : entry . id } ;
126+ const actions = getActionBarActions ( menu . getActions ( { shouldForwardArgs : true , arg : menuArg } ) , g => / ^ i n l i n e / . test ( g ) ) ;
122127 toolbar . setActions ( actions . primary , actions . secondary ) ;
123128
124129 template . elementDisposables . add ( menu . onDidChange ( ( ) => {
125- const actions = getActionBarActions ( menu . getActions ( { shouldForwardArgs : true } ) , g => / ^ i n l i n e / . test ( g ) ) ;
130+ const actions = getActionBarActions ( menu . getActions ( { shouldForwardArgs : true , arg : menuArg } ) , g => / ^ i n l i n e / . test ( g ) ) ;
126131 toolbar . setActions ( actions . primary , actions . secondary ) ;
127132 } ) ) ;
128133 }
@@ -190,6 +195,7 @@ class CustomEditorExtensionOutline implements IOutline<CustomEditorOutlineEntry>
190195 private _entries : CustomEditorOutlineEntry [ ] = [ ] ;
191196 private _activeEntry : CustomEditorOutlineEntry | undefined ;
192197 private _flatMap = new Map < string , CustomEditorOutlineEntry > ( ) ;
198+ private _loadCts : CancellationTokenSource | undefined ;
193199 private readonly _resource : URI ;
194200 private readonly _viewType : string ;
195201
@@ -300,7 +306,10 @@ class CustomEditorExtensionOutline implements IOutline<CustomEditorOutlineEntry>
300306 }
301307
302308 private async _loadItems ( ) : Promise < void > {
303- const cts = new CancellationTokenSource ( ) ;
309+ // Cancel any previous in-flight request to avoid stale responses overwriting newer data
310+ this . _loadCts ?. cancel ( ) ;
311+ this . _loadCts ?. dispose ( ) ;
312+ const cts = this . _loadCts = new CancellationTokenSource ( ) ;
304313 try {
305314 const dtos = await this . _providerService . provideOutline ( this . _viewType , cts . token ) ;
306315 if ( cts . token . isCancellationRequested ) {
@@ -315,6 +324,9 @@ class CustomEditorExtensionOutline implements IOutline<CustomEditorOutlineEntry>
315324
316325 this . _onDidChange . fire ( { } ) ;
317326 } finally {
327+ if ( this . _loadCts === cts ) {
328+ this . _loadCts = undefined ;
329+ }
318330 cts . dispose ( ) ;
319331 }
320332 }
@@ -351,6 +363,8 @@ class CustomEditorExtensionOutline implements IOutline<CustomEditorOutlineEntry>
351363 }
352364
353365 dispose ( ) : void {
366+ this . _loadCts ?. cancel ( ) ;
367+ this . _loadCts ?. dispose ( ) ;
354368 this . _disposables . dispose ( ) ;
355369 this . _onDidChange . dispose ( ) ;
356370 }
0 commit comments