@@ -71,7 +71,12 @@ interface OutputNotificationBody {
7171
7272interface InactiveRegionParams {
7373 uri : string ;
74- ranges : vscode . Range [ ] ;
74+ ranges : InputRange [ ] ;
75+ }
76+
77+ interface InputRange {
78+ start : { line : number ; character : number } ;
79+ end : { line : number ; character : number } ;
7580}
7681
7782interface DecorationRangesPair {
@@ -651,30 +656,36 @@ class DefaultClient implements Client {
651656 } ;
652657 let decoration : vscode . TextEditorDecorationType = vscode . window . createTextEditorDecorationType ( renderOptions ) ;
653658
659+ // As InactiveRegionParams.ranges is deserialized as POD, we must convert to vscode.Ranges in order to make use of the API's
660+ let ranges : vscode . Range [ ] = [ ] ;
661+ params . ranges . forEach ( element => {
662+ ranges . push ( new vscode . Range ( element . start . line , element . start . character , element . end . line , element . end . character ) ) ;
663+ } ) ;
664+
654665 // Recycle the active text decorations when we receive a new set of inactive regions
655666 let valuePair : DecorationRangesPair = this . inactiveRegionsDecorations . get ( params . uri ) ;
656667 if ( valuePair ) {
657- // The language server will send notifications regardless of whether the ranges have changed
658- if ( ! this . areRangesEqual ( valuePair . ranges , params . ranges ) ) {
668+ // 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
669+ if ( ! this . areRangesEqual ( valuePair . ranges , ranges ) ) {
659670 // Disposing of and resetting the decoration will undo previously applied text decorations
660671 valuePair . decoration . dispose ( ) ;
661672 valuePair . decoration = decoration ;
662673
663674 // As vscode.TextEditor.setDecorations only applies to visible editors, we must cache the range for when another editor becomes visible
664- valuePair . ranges = params . ranges ;
675+ valuePair . ranges = ranges ;
665676 }
666677 } else { // The entry does not exist. Make a new one
667678 let toInsert : DecorationRangesPair = {
668679 decoration : decoration ,
669- ranges : params . ranges
680+ ranges : ranges
670681 } ;
671682 this . inactiveRegionsDecorations . set ( params . uri , toInsert ) ;
672683 }
673684
674685 // Apply the decorations to all *visible* text editors
675686 let editors : vscode . TextEditor [ ] = vscode . window . visibleTextEditors . filter ( e => e . document . uri . toString ( ) === params . uri ) ;
676687 for ( let e of editors ) {
677- e . setDecorations ( decoration , params . ranges ) ;
688+ e . setDecorations ( decoration , ranges ) ;
678689 }
679690 }
680691
0 commit comments