@@ -9,7 +9,7 @@ import { URI, UriComponents } from 'vs/base/common/uri';
9
9
import { Event , Emitter } from 'vs/base/common/event' ;
10
10
import { debounce } from 'vs/base/common/decorators' ;
11
11
import { DisposableStore , IDisposable , MutableDisposable } from 'vs/base/common/lifecycle' ;
12
- import { asPromise } from 'vs/base/common/async' ;
12
+ import { asPromise , Sequencer } from 'vs/base/common/async' ;
13
13
import { ExtHostCommands } from 'vs/workbench/api/common/extHostCommands' ;
14
14
import { MainContext , MainThreadSCMShape , SCMRawResource , SCMRawResourceSplice , SCMRawResourceSplices , IMainContext , ExtHostSCMShape , ICommandDto , MainThreadTelemetryShape , SCMGroupFeatures , SCMHistoryItemDto , SCMHistoryItemChangeDto } from './extHost.protocol' ;
15
15
import { sortedDiff , equals } from 'vs/base/common/arrays' ;
@@ -259,7 +259,7 @@ export class ExtHostSCMInputBox implements vscode.SourceControlInputBox {
259
259
260
260
set value ( value : string ) {
261
261
value = value ?? '' ;
262
- this . #proxy. $setInputBoxValue ( this . _sourceControlHandle , value ) ;
262
+ this . _sequencer . queue ( async ( ) => this . #proxy. $setInputBoxValue ( this . _sourceControlHandle , value ) ) ;
263
263
this . updateValue ( value ) ;
264
264
}
265
265
@@ -276,7 +276,7 @@ export class ExtHostSCMInputBox implements vscode.SourceControlInputBox {
276
276
}
277
277
278
278
set placeholder ( placeholder : string ) {
279
- this . #proxy. $setInputBoxPlaceholder ( this . _sourceControlHandle , placeholder ) ;
279
+ this . _sequencer . queue ( async ( ) => this . #proxy. $setInputBoxPlaceholder ( this . _sourceControlHandle , placeholder ) ) ;
280
280
this . _placeholder = placeholder ;
281
281
}
282
282
@@ -296,7 +296,7 @@ export class ExtHostSCMInputBox implements vscode.SourceControlInputBox {
296
296
}
297
297
298
298
this . _validateInput = fn ;
299
- this . #proxy. $setValidationProviderIsEnabled ( this . _sourceControlHandle , ! ! fn ) ;
299
+ this . _sequencer . queue ( async ( ) => this . #proxy. $setValidationProviderIsEnabled ( this . _sourceControlHandle , ! ! fn ) ) ;
300
300
}
301
301
302
302
private _enabled : boolean = true ;
@@ -313,7 +313,7 @@ export class ExtHostSCMInputBox implements vscode.SourceControlInputBox {
313
313
}
314
314
315
315
this . _enabled = enabled ;
316
- this . #proxy. $setInputBoxEnablement ( this . _sourceControlHandle , enabled ) ;
316
+ this . _sequencer . queue ( async ( ) => this . #proxy. $setInputBoxEnablement ( this . _sourceControlHandle , enabled ) ) ;
317
317
}
318
318
319
319
private _visible : boolean = true ;
@@ -330,7 +330,7 @@ export class ExtHostSCMInputBox implements vscode.SourceControlInputBox {
330
330
}
331
331
332
332
this . _visible = visible ;
333
- this . #proxy. $setInputBoxVisibility ( this . _sourceControlHandle , visible ) ;
333
+ this . _sequencer . queue ( async ( ) => this . #proxy. $setInputBoxVisibility ( this . _sourceControlHandle , visible ) ) ;
334
334
}
335
335
336
336
get document ( ) : vscode . TextDocument {
@@ -339,15 +339,15 @@ export class ExtHostSCMInputBox implements vscode.SourceControlInputBox {
339
339
return this . #extHostDocuments. getDocument ( this . _documentUri ) ;
340
340
}
341
341
342
- constructor ( private _extension : IExtensionDescription , _extHostDocuments : ExtHostDocuments , proxy : MainThreadSCMShape , private _sourceControlHandle : number , private _documentUri : URI ) {
342
+ constructor ( private _extension : IExtensionDescription , _extHostDocuments : ExtHostDocuments , proxy : MainThreadSCMShape , private _sequencer : Sequencer , private _sourceControlHandle : number , private _documentUri : URI ) {
343
343
this . #extHostDocuments = _extHostDocuments ;
344
344
this . #proxy = proxy ;
345
345
}
346
346
347
347
showValidationMessage ( message : string | vscode . MarkdownString , type : vscode . SourceControlInputBoxValidationType ) {
348
348
checkProposedApiEnabled ( this . _extension , 'scmValidation' ) ;
349
349
350
- this . #proxy. $showValidationMessage ( this . _sourceControlHandle , message , type as any ) ;
350
+ this . _sequencer . queue ( async ( ) => this . #proxy. $showValidationMessage ( this . _sourceControlHandle , message , type as any ) ) ;
351
351
}
352
352
353
353
$onInputBoxValueChange ( value : string ) : void {
@@ -386,14 +386,14 @@ class ExtHostSourceControlResourceGroup implements vscode.SourceControlResourceG
386
386
get label ( ) : string { return this . _label ; }
387
387
set label ( label : string ) {
388
388
this . _label = label ;
389
- this . _proxy . $updateGroupLabel ( this . _sourceControlHandle , this . handle , label ) ;
389
+ this . _sequencer . queue ( async ( ) => this . _proxy . $updateGroupLabel ( this . _sourceControlHandle , this . handle , label ) ) ;
390
390
}
391
391
392
392
private _hideWhenEmpty : boolean | undefined = undefined ;
393
393
get hideWhenEmpty ( ) : boolean | undefined { return this . _hideWhenEmpty ; }
394
394
set hideWhenEmpty ( hideWhenEmpty : boolean | undefined ) {
395
395
this . _hideWhenEmpty = hideWhenEmpty ;
396
- this . _proxy . $updateGroup ( this . _sourceControlHandle , this . handle , this . features ) ;
396
+ this . _sequencer . queue ( async ( ) => this . _proxy . $updateGroup ( this . _sourceControlHandle , this . handle , this . features ) ) ;
397
397
}
398
398
399
399
get features ( ) : SCMGroupFeatures {
@@ -413,6 +413,7 @@ class ExtHostSourceControlResourceGroup implements vscode.SourceControlResourceG
413
413
constructor (
414
414
private _proxy : MainThreadSCMShape ,
415
415
private _commands : ExtHostCommands ,
416
+ private _sequencer : Sequencer ,
416
417
private _sourceControlHandle : number ,
417
418
private _id : string ,
418
419
private _label : string ,
@@ -511,6 +512,7 @@ class ExtHostSourceControl implements vscode.SourceControl {
511
512
512
513
#proxy: MainThreadSCMShape ;
513
514
515
+ private readonly _sequencer = new Sequencer ( ) ;
514
516
private _groups : Map < GroupHandle , ExtHostSourceControlResourceGroup > = new Map < GroupHandle , ExtHostSourceControlResourceGroup > ( ) ;
515
517
516
518
get id ( ) : string {
@@ -540,7 +542,7 @@ class ExtHostSourceControl implements vscode.SourceControl {
540
542
}
541
543
542
544
this . _count = count ;
543
- this . #proxy. $updateSourceControl ( this . handle , { count } ) ;
545
+ this . _sequencer . queue ( async ( ) => this . #proxy. $updateSourceControl ( this . handle , { count } ) ) ;
544
546
}
545
547
546
548
private _quickDiffProvider : vscode . QuickDiffProvider | undefined = undefined ;
@@ -555,7 +557,7 @@ class ExtHostSourceControl implements vscode.SourceControl {
555
557
if ( isProposedApiEnabled ( this . _extension , 'quickDiffProvider' ) ) {
556
558
quickDiffLabel = quickDiffProvider ?. label ;
557
559
}
558
- this . #proxy. $updateSourceControl ( this . handle , { hasQuickDiffProvider : ! ! quickDiffProvider , quickDiffLabel } ) ;
560
+ this . _sequencer . queue ( async ( ) => this . #proxy. $updateSourceControl ( this . handle , { hasQuickDiffProvider : ! ! quickDiffProvider , quickDiffLabel } ) ) ;
559
561
}
560
562
561
563
private _historyProvider : vscode . SourceControlHistoryProvider | undefined ;
@@ -573,12 +575,12 @@ class ExtHostSourceControl implements vscode.SourceControl {
573
575
this . _historyProvider = historyProvider ;
574
576
this . _historyProviderDisposable . value = new DisposableStore ( ) ;
575
577
576
- this . #proxy. $updateSourceControl ( this . handle , { hasHistoryProvider : ! ! historyProvider } ) ;
578
+ this . _sequencer . queue ( async ( ) => this . #proxy. $updateSourceControl ( this . handle , { hasHistoryProvider : ! ! historyProvider } ) ) ;
577
579
578
580
if ( historyProvider ) {
579
581
this . _historyProviderDisposable . value . add ( historyProvider . onDidChangeCurrentHistoryItemGroup ( ( ) => {
580
582
this . _historyProviderCurrentHistoryItemGroup = historyProvider ?. currentHistoryItemGroup ;
581
- this . #proxy. $onDidChangeHistoryProviderCurrentHistoryItemGroup ( this . handle , this . _historyProviderCurrentHistoryItemGroup ) ;
583
+ this . _sequencer . queue ( async ( ) => this . #proxy. $onDidChangeHistoryProviderCurrentHistoryItemGroup ( this . handle , this . _historyProviderCurrentHistoryItemGroup ) ) ;
582
584
} ) ) ;
583
585
}
584
586
}
@@ -595,7 +597,7 @@ class ExtHostSourceControl implements vscode.SourceControl {
595
597
}
596
598
597
599
this . _commitTemplate = commitTemplate ;
598
- this . #proxy. $updateSourceControl ( this . handle , { commitTemplate } ) ;
600
+ this . _sequencer . queue ( async ( ) => this . #proxy. $updateSourceControl ( this . handle , { commitTemplate } ) ) ;
599
601
}
600
602
601
603
private readonly _acceptInputDisposables = new MutableDisposable < DisposableStore > ( ) ;
@@ -611,7 +613,7 @@ class ExtHostSourceControl implements vscode.SourceControl {
611
613
this . _acceptInputCommand = acceptInputCommand ;
612
614
613
615
const internal = this . _commands . converter . toInternal ( acceptInputCommand , this . _acceptInputDisposables . value ) ;
614
- this . #proxy. $updateSourceControl ( this . handle , { acceptInputCommand : internal } ) ;
616
+ this . _sequencer . queue ( async ( ) => this . #proxy. $updateSourceControl ( this . handle , { acceptInputCommand : internal } ) ) ;
615
617
}
616
618
617
619
private readonly _actionButtonDisposables = new MutableDisposable < DisposableStore > ( ) ;
@@ -635,7 +637,7 @@ class ExtHostSourceControl implements vscode.SourceControl {
635
637
description : actionButton . description ,
636
638
enabled : actionButton . enabled
637
639
} : undefined ;
638
- this . #proxy. $updateSourceControl ( this . handle , { actionButton : internal ?? null } ) ;
640
+ this . _sequencer . queue ( async ( ) => this . #proxy. $updateSourceControl ( this . handle , { actionButton : internal ?? null } ) ) ;
639
641
}
640
642
641
643
@@ -656,7 +658,7 @@ class ExtHostSourceControl implements vscode.SourceControl {
656
658
this . _statusBarCommands = statusBarCommands ;
657
659
658
660
const internal = ( statusBarCommands || [ ] ) . map ( c => this . _commands . converter . toInternal ( c , this . _statusBarDisposables . value ! ) ) as ICommandDto [ ] ;
659
- this . #proxy. $updateSourceControl ( this . handle , { statusBarCommands : internal } ) ;
661
+ this . _sequencer . queue ( async ( ) => this . #proxy. $updateSourceControl ( this . handle , { statusBarCommands : internal } ) ) ;
660
662
}
661
663
662
664
private _selected : boolean = false ;
@@ -687,16 +689,16 @@ class ExtHostSourceControl implements vscode.SourceControl {
687
689
query : _rootUri ? `rootUri=${ encodeURIComponent ( _rootUri . toString ( ) ) } ` : undefined
688
690
} ) ;
689
691
690
- this . _inputBox = new ExtHostSCMInputBox ( _extension , _extHostDocuments , this . #proxy, this . handle , inputBoxDocumentUri ) ;
691
- this . #proxy . $registerSourceControl ( this . handle , _id , _label , _rootUri , inputBoxDocumentUri ) ;
692
+ this . _sequencer . queue ( ( ) => this . #proxy. $registerSourceControl ( this . handle , _id , _label , _rootUri , inputBoxDocumentUri ) ) ;
693
+ this . _inputBox = new ExtHostSCMInputBox ( _extension , _extHostDocuments , this . #proxy , this . _sequencer , this . handle , inputBoxDocumentUri ) ;
692
694
}
693
695
694
696
private createdResourceGroups = new Map < ExtHostSourceControlResourceGroup , IDisposable > ( ) ;
695
697
private updatedResourceGroups = new Set < ExtHostSourceControlResourceGroup > ( ) ;
696
698
697
699
createResourceGroup ( id : string , label : string , options ?: { multiDiffEditorEnableViewChanges ?: boolean } ) : ExtHostSourceControlResourceGroup {
698
700
const multiDiffEditorEnableViewChanges = isProposedApiEnabled ( this . _extension , 'scmMultiDiffEditor' ) && options ?. multiDiffEditorEnableViewChanges === true ;
699
- const group = new ExtHostSourceControlResourceGroup ( this . #proxy, this . _commands , this . handle , id , label , multiDiffEditorEnableViewChanges , this . _extension ) ;
701
+ const group = new ExtHostSourceControlResourceGroup ( this . #proxy, this . _commands , this . _sequencer , this . handle , id , label , multiDiffEditorEnableViewChanges , this . _extension ) ;
700
702
const disposable = Event . once ( group . onDidDispose ) ( ( ) => this . createdResourceGroups . delete ( group ) ) ;
701
703
this . createdResourceGroups . set ( group , disposable ) ;
702
704
this . eventuallyAddResourceGroups ( ) ;
@@ -720,7 +722,7 @@ class ExtHostSourceControl implements vscode.SourceControl {
720
722
this . updatedResourceGroups . delete ( group ) ;
721
723
updateListener . dispose ( ) ;
722
724
this . _groups . delete ( group . handle ) ;
723
- this . #proxy. $unregisterGroup ( this . handle , group . handle ) ;
725
+ this . _sequencer . queue ( async ( ) => this . #proxy. $unregisterGroup ( this . handle , group . handle ) ) ;
724
726
} ) ;
725
727
726
728
groups . push ( [ group . handle , group . id , group . label , group . features , group . multiDiffEditorEnableViewChanges ] ) ;
@@ -734,7 +736,7 @@ class ExtHostSourceControl implements vscode.SourceControl {
734
736
this . _groups . set ( group . handle , group ) ;
735
737
}
736
738
737
- this . #proxy. $registerGroups ( this . handle , groups , splices ) ;
739
+ this . _sequencer . queue ( async ( ) => this . #proxy. $registerGroups ( this . handle , groups , splices ) ) ;
738
740
this . createdResourceGroups . clear ( ) ;
739
741
}
740
742
@@ -753,7 +755,7 @@ class ExtHostSourceControl implements vscode.SourceControl {
753
755
} ) ;
754
756
755
757
if ( splices . length > 0 ) {
756
- this . #proxy. $spliceResourceStates ( this . handle , splices ) ;
758
+ this . _sequencer . queue ( async ( ) => this . #proxy. $spliceResourceStates ( this . handle , splices ) ) ;
757
759
}
758
760
759
761
this . updatedResourceGroups . clear ( ) ;
@@ -774,7 +776,7 @@ class ExtHostSourceControl implements vscode.SourceControl {
774
776
this . _statusBarDisposables . dispose ( ) ;
775
777
776
778
this . _groups . forEach ( group => group . dispose ( ) ) ;
777
- this . #proxy. $unregisterSourceControl ( this . handle ) ;
779
+ this . _sequencer . queue ( async ( ) => this . #proxy. $unregisterSourceControl ( this . handle ) ) ;
778
780
}
779
781
}
780
782
0 commit comments