@@ -7,6 +7,7 @@ import { h } from 'vs/base/browser/dom';
7
7
import { ActionBar } from 'vs/base/browser/ui/actionbar/actionbar' ;
8
8
import { KeybindingLabel , unthemedKeybindingLabelOptions } from 'vs/base/browser/ui/keybindingLabel/keybindingLabel' ;
9
9
import { Action , IAction , Separator } from 'vs/base/common/actions' ;
10
+ import { equals } from 'vs/base/common/arrays' ;
10
11
import { RunOnceScheduler } from 'vs/base/common/async' ;
11
12
import { Codicon } from 'vs/base/common/codicons' ;
12
13
import { Disposable , toDisposable } from 'vs/base/common/lifecycle' ;
@@ -154,6 +155,10 @@ export class InlineSuggestionHintsContentWidget extends Disposable implements IC
154
155
this . previousAction . enabled = this . nextAction . enabled = false ;
155
156
} , 100 ) ) ;
156
157
158
+ private lastCurrentSuggestionIdx = - 1 ;
159
+ private lastSuggestionCount = - 1 ;
160
+ private lastCommands : Command [ ] = [ ] ;
161
+
157
162
constructor (
158
163
private readonly editor : ICodeEditor ,
159
164
private readonly withBorder : boolean ,
@@ -186,7 +191,18 @@ export class InlineSuggestionHintsContentWidget extends Disposable implements IC
186
191
}
187
192
188
193
public update ( position : Position | null , currentSuggestionIdx : number , suggestionCount : number | undefined , extraCommands : Command [ ] ) : void {
194
+ if ( this . position === position
195
+ && this . lastCurrentSuggestionIdx === currentSuggestionIdx
196
+ && this . lastSuggestionCount === suggestionCount
197
+ && equals ( this . lastCommands , extraCommands ) ) {
198
+ // nothing to update
199
+ return ;
200
+ }
201
+
189
202
this . position = position ;
203
+ this . lastCurrentSuggestionIdx = currentSuggestionIdx ;
204
+ this . lastSuggestionCount = suggestionCount ?? - 1 ;
205
+ this . lastCommands = extraCommands ;
190
206
191
207
if ( suggestionCount !== undefined && suggestionCount > 1 ) {
192
208
this . disableButtonsDebounced . cancel ( ) ;
@@ -298,6 +314,11 @@ export class CustomizedMenuWorkbenchToolBar extends WorkbenchToolBar {
298
314
}
299
315
300
316
setAdditionalSecondaryActions ( actions : IAction [ ] ) : void {
317
+ if ( equals ( this . additionalActions , actions , ( a , b ) => a === b ) ) {
318
+ // don't update if the actions are the same
319
+ return ;
320
+ }
321
+
301
322
this . additionalActions = actions ;
302
323
this . updateToolbar ( ) ;
303
324
}
0 commit comments