@@ -442,7 +442,7 @@ export class ColorizationState {
442442 this . disposeColorizationDecorations ( ) ;
443443 }
444444
445- public refresh ( e : vscode . TextEditor ) : void {
445+ private refreshInner ( e : vscode . TextEditor ) : void {
446446 // Clear inactive regions
447447 if ( this . inactiveDecoration ) {
448448 e . setDecorations ( this . inactiveDecoration , [ ] ) ;
@@ -466,19 +466,26 @@ export class ColorizationState {
466466 }
467467 }
468468 // Apply dimming last
469- if ( settings . dimInactiveRegions && this . inactiveRanges ) {
469+ if ( settings . dimInactiveRegions && this . inactiveDecoration && this . inactiveRanges ) {
470470 e . setDecorations ( this . inactiveDecoration , this . inactiveRanges ) ;
471471 }
472472 }
473473
474+ public refresh ( e : vscode . TextEditor ) : void {
475+ let f : ( ) => void = async ( ) => {
476+ this . refreshInner ( e ) ;
477+ } ;
478+ this . colorizationSettings . syncWithLoadingSettings ( f ) ;
479+ }
480+
474481 public onSettingsChanged ( uri : vscode . Uri ) : void {
475482 let f : ( ) => void = async ( ) => {
476483 this . disposeColorizationDecorations ( ) ;
477484 let isCpp : boolean = util . isEditorFileCpp ( uri . toString ( ) ) ;
478485 this . createColorizationDecorations ( isCpp ) ;
479486 let editors : vscode . TextEditor [ ] = vscode . window . visibleTextEditors . filter ( e => e . document . uri === uri ) ;
480487 for ( let e of editors ) {
481- this . refresh ( e ) ;
488+ this . refreshInner ( e ) ;
482489 }
483490 } ;
484491 this . colorizationSettings . syncWithLoadingSettings ( f ) ;
@@ -650,7 +657,7 @@ export class ColorizationState {
650657 // Apply the decorations to all *visible* text editors
651658 let editors : vscode . TextEditor [ ] = vscode . window . visibleTextEditors . filter ( e => e . document . uri . toString ( ) === uri ) ;
652659 for ( let e of editors ) {
653- this . refresh ( e ) ;
660+ this . refreshInner ( e ) ;
654661 }
655662 } ;
656663 this . colorizationSettings . syncWithLoadingSettings ( f ) ;
0 commit comments