@@ -71,12 +71,12 @@ interface OutputNotificationBody {
71
71
72
72
interface InactiveRegionParams {
73
73
uri : string ;
74
- ranges : InputRange [ ] ;
74
+ regions : InputRegion [ ] ;
75
75
}
76
76
77
- interface InputRange {
78
- start : { line : number ; character : number } ;
79
- end : { line : number ; character : number } ;
77
+ interface InputRegion {
78
+ startLine : number ;
79
+ endLine : number ;
80
80
}
81
81
82
82
interface DecorationRangesPair {
@@ -137,8 +137,9 @@ function collectSettingsForTelemetry(filter: (key: string, val: string, settings
137
137
let curSetting : any = util . packageJson . contributes . configuration . properties [ "C_Cpp." + key ] ;
138
138
if ( curSetting ) {
139
139
let curEnum : any [ ] = curSetting [ "enum" ] ;
140
- if ( curEnum && curEnum . indexOf ( val ) === - 1 )
140
+ if ( curEnum && curEnum . indexOf ( val ) === - 1 ) {
141
141
continue ;
142
+ }
142
143
}
143
144
144
145
if ( filter ( key , val , settings ) ) {
@@ -699,24 +700,22 @@ class DefaultClient implements Client {
699
700
} ;
700
701
let decoration : vscode . TextEditorDecorationType = vscode . window . createTextEditorDecorationType ( renderOptions ) ;
701
702
702
- // As InactiveRegionParams.ranges is deserialized as POD, we must convert to vscode.Ranges in order to make use of the API's
703
+ // We must convert to vscode.Ranges in order to make use of the API's
703
704
let ranges : vscode . Range [ ] = [ ] ;
704
- params . ranges . forEach ( element => {
705
- ranges . push ( new vscode . Range ( element . start . line , element . start . character , element . end . line , element . end . character ) ) ;
705
+ params . regions . forEach ( element => {
706
+ let newRange : vscode . Range = new vscode . Range ( element . startLine , 0 , element . endLine , 0 ) ;
707
+ ranges . push ( newRange ) ;
706
708
} ) ;
707
709
708
- // Recycle the active text decorations when we receive a new set of inactive regions
710
+ // Find entry for cached file and act accordingly
709
711
let valuePair : DecorationRangesPair = this . inactiveRegionsDecorations . get ( params . uri ) ;
710
712
if ( valuePair ) {
711
- // The language server will send notifications regardless of whether the ranges have changed, so we must check to see if the new data reflects a change
712
- if ( ! this . areRangesEqual ( valuePair . ranges , ranges ) ) {
713
- // Disposing of and resetting the decoration will undo previously applied text decorations
714
- valuePair . decoration . dispose ( ) ;
715
- valuePair . decoration = decoration ;
716
-
717
- // As vscode.TextEditor.setDecorations only applies to visible editors, we must cache the range for when another editor becomes visible
718
- valuePair . ranges = ranges ;
719
- }
713
+ // Disposing of and resetting the decoration will undo previously applied text decorations
714
+ valuePair . decoration . dispose ( ) ;
715
+ valuePair . decoration = decoration ;
716
+
717
+ // As vscode.TextEditor.setDecorations only applies to visible editors, we must cache the range for when another editor becomes visible
718
+ valuePair . ranges = ranges ;
720
719
} else { // The entry does not exist. Make a new one
721
720
let toInsert : DecorationRangesPair = {
722
721
decoration : decoration ,
@@ -732,21 +731,6 @@ class DefaultClient implements Client {
732
731
}
733
732
}
734
733
735
- // Helper method to compare two ranges arrays for equality
736
- private areRangesEqual ( r1 : vscode . Range [ ] , r2 : vscode . Range [ ] ) : boolean {
737
- if ( r1 . length !== r2 . length ) {
738
- return false ;
739
- }
740
-
741
- for ( let i : number = 0 ; i < r1 . length ; ++ i ) {
742
- if ( ! r1 [ i ] . isEqual ( r2 [ i ] ) ) {
743
- return false ;
744
- }
745
- }
746
-
747
- return true ;
748
- }
749
-
750
734
/*********************************************
751
735
* requests to the language server
752
736
*********************************************/
0 commit comments