@@ -165,6 +165,7 @@ export interface Client {
165
165
Name : string ;
166
166
TrackedDocuments : Set < vscode . TextDocument > ;
167
167
onDidChangeSettings ( ) : void ;
168
+ onDidChangeVisibleTextEditors ( editors : vscode . TextEditor [ ] ) : void ;
168
169
takeOwnership ( document : vscode . TextDocument ) : void ;
169
170
requestGoToDeclaration ( ) : Thenable < void > ;
170
171
requestSwitchHeaderSource ( rootPath : string , fileName : string ) : Thenable < string > ;
@@ -204,7 +205,7 @@ class DefaultClient implements Client {
204
205
private crashTimes : number [ ] = [ ] ;
205
206
private failureMessageShown = new PersistentState < boolean > ( "DefaultClient.failureMessageShown" , false ) ;
206
207
private isSupported : boolean = true ;
207
- private inactiveRegionsDecoration : vscode . TextEditorDecorationType ;
208
+ private inactiveRegionsDecorations = new Map < string , [ vscode . TextEditorDecorationType , vscode . Range [ ] ] > ( ) ;
208
209
209
210
// The "model" that is displayed via the UI (status bar).
210
211
private model : ClientModel = {
@@ -635,15 +636,23 @@ class DefaultClient implements Client {
635
636
} ;
636
637
637
638
// Recycle the active text decorations when we receive a new set of inactive regions
638
- if ( this . inactiveRegionsDecoration !== undefined ) {
639
- this . inactiveRegionsDecoration . dispose ( ) ;
639
+ if ( this . inactiveRegionsDecorations . has ( params . uri ) ) {
640
+ this . inactiveRegionsDecorations . get ( params . uri ) [ 0 ] . dispose ( ) ;
640
641
}
641
- this . inactiveRegionsDecoration = vscode . window . createTextEditorDecorationType ( renderOptions ) ;
642
+ let decoration : vscode . TextEditorDecorationType = vscode . window . createTextEditorDecorationType ( renderOptions ) ;
643
+ this . inactiveRegionsDecorations . set ( params . uri , [ decoration , params . ranges ] ) ;
642
644
643
645
// Apply the decorations to all relevant editors
644
646
let editors : vscode . TextEditor [ ] = vscode . window . visibleTextEditors . filter ( e => e . document . uri . toString ( ) === params . uri ) ;
645
647
for ( let e of editors ) {
646
- e . setDecorations ( this . inactiveRegionsDecoration , params . ranges ) ;
648
+ e . setDecorations ( this . inactiveRegionsDecorations . get ( params . uri ) [ 0 ] , params . ranges ) ;
649
+ }
650
+ }
651
+
652
+ public onDidChangeVisibleTextEditors ( editors : vscode . TextEditor [ ] ) : void {
653
+ for ( let e of editors ) {
654
+ let value : [ vscode . TextEditorDecorationType , vscode . Range [ ] ] = this . inactiveRegionsDecorations . get ( e . document . uri . toString ( ) ) ;
655
+ e . setDecorations ( value [ 0 ] , value [ 1 ] ) ;
647
656
}
648
657
}
649
658
@@ -836,6 +845,7 @@ class NullClient implements Client {
836
845
Name : string = "(empty)" ;
837
846
TrackedDocuments = new Set < vscode . TextDocument > ( ) ;
838
847
onDidChangeSettings ( ) : void { }
848
+ onDidChangeVisibleTextEditors ( editors : vscode . TextEditor [ ] ) : void { }
839
849
takeOwnership ( document : vscode . TextDocument ) : void { }
840
850
requestGoToDeclaration ( ) : Thenable < void > { return Promise . resolve ( ) ; }
841
851
requestSwitchHeaderSource ( rootPath : string , fileName : string ) : Thenable < string > { return Promise . resolve ( "" ) ; }
0 commit comments