@@ -21,6 +21,7 @@ import { createProtocolFilter } from './protocolFilter';
21
21
import { DataBinding } from './dataBinding' ;
22
22
import minimatch = require( "minimatch" ) ;
23
23
import * as logger from '../logger' ;
24
+ import { deactivate } from './extension' ;
24
25
25
26
let ui : UI ;
26
27
@@ -193,6 +194,11 @@ export function createNullClient(): Client {
193
194
return new NullClient ( ) ;
194
195
}
195
196
197
+ interface decorationRangesPair {
198
+ decoration : vscode . TextEditorDecorationType ;
199
+ ranges : vscode . Range [ ] ;
200
+ }
201
+
196
202
class DefaultClient implements Client {
197
203
private languageClient : LanguageClient ; // The "client" that launches and communicates with our language "server" process.
198
204
private disposables : vscode . Disposable [ ] = [ ] ;
@@ -205,7 +211,7 @@ class DefaultClient implements Client {
205
211
private crashTimes : number [ ] = [ ] ;
206
212
private failureMessageShown = new PersistentState < boolean > ( "DefaultClient.failureMessageShown" , false ) ;
207
213
private isSupported : boolean = true ;
208
- private inactiveRegionsDecorations = new Map < string , [ vscode . TextEditorDecorationType , vscode . Range [ ] ] > ( ) ;
214
+ private inactiveRegionsDecorations = new Map < string , decorationRangesPair > ( ) ;
209
215
210
216
// The "model" that is displayed via the UI (status bar).
211
217
private model : ClientModel = {
@@ -393,8 +399,10 @@ class DefaultClient implements Client {
393
399
public onDidChangeVisibleTextEditors ( editors : vscode . TextEditor [ ] ) : void {
394
400
//Apply text decorations to inactive regions
395
401
for ( let e of editors ) {
396
- let valuePair : [ vscode . TextEditorDecorationType , vscode . Range [ ] ] = this . inactiveRegionsDecorations . get ( e . document . uri . toString ( ) ) ;
397
- e . setDecorations ( valuePair [ 0 ] , valuePair [ 1 ] ) ; // VSCode clears the decorations when the text editor becomes invisible
402
+ let valuePair : decorationRangesPair = this . inactiveRegionsDecorations . get ( e . document . uri . toString ( ) ) ;
403
+ //if (valuePair !== undefined) {
404
+ e . setDecorations ( valuePair . decoration , valuePair . ranges ) ; // VSCode clears the decorations when the text editor becomes invisible
405
+ //}
398
406
}
399
407
}
400
408
@@ -639,21 +647,25 @@ class DefaultClient implements Client {
639
647
640
648
private updateInactiveRegions ( params : InactiveRegionParams ) : void {
641
649
let renderOptions : vscode . DecorationRenderOptions = {
642
- light : { color : "rgba(125,125,125 ,1.0)" } ,
650
+ light : { color : "rgba(175,175,175 ,1.0)" } ,
643
651
dark : { color : "rgba(155,155,155,1.0)" }
644
652
} ;
645
653
let decoration : vscode . TextEditorDecorationType = vscode . window . createTextEditorDecorationType ( renderOptions ) ;
646
654
647
655
// Recycle the active text decorations when we receive a new set of inactive regions
648
- let valuePair : [ vscode . TextEditorDecorationType , vscode . Range [ ] ] = this . inactiveRegionsDecorations . get ( params . uri ) ;
656
+ let valuePair : decorationRangesPair = this . inactiveRegionsDecorations . get ( params . uri ) ;
649
657
if ( valuePair !== undefined ) {
650
658
// Disposing of and resetting the decoration will undo previously applied text decorations
651
- valuePair [ 0 ] . dispose ( ) ;
652
- valuePair [ 0 ] = decoration ;
659
+ valuePair . decoration . dispose ( ) ;
660
+ valuePair . decoration = decoration ;
653
661
654
- valuePair [ 1 ] = params . ranges ; // As vscode.TextEditor.setDecorations only applies to visible editors, we must cache the range for when another editor becomes visible
662
+ valuePair . ranges = params . ranges ; // As vscode.TextEditor.setDecorations only applies to visible editors, we must cache the range for when another editor becomes visible
655
663
} else { // The entry does not exist. Make a new one
656
- this . inactiveRegionsDecorations . set ( params . uri , [ decoration , params . ranges ] ) ;
664
+ let toInsert : decorationRangesPair = {
665
+ decoration : decoration ,
666
+ ranges : params . ranges
667
+ } ;
668
+ this . inactiveRegionsDecorations . set ( params . uri , toInsert ) ;
657
669
}
658
670
659
671
// Apply the decorations to all *visible* text editors
0 commit comments