@@ -583,34 +583,40 @@ class DefaultClient implements Client {
583583 private editVersion : number = 0 ;
584584
585585 public onDidChangeTextDocument ( textDocumentChangeEvent : vscode . TextDocumentChangeEvent ) : void {
586- if ( textDocumentChangeEvent . document . languageId === "cpp" || textDocumentChangeEvent . document . languageId === "c" ) {
587- this . editVersion ++ ;
588- try {
589- let colorizationState : ColorizationState = this . getColorizationState ( textDocumentChangeEvent . document . uri . toString ( ) ) ;
586+ if ( textDocumentChangeEvent . document . uri . scheme === "file" ) {
587+ if ( textDocumentChangeEvent . document . languageId === "cpp" || textDocumentChangeEvent . document . languageId === "c" ) {
588+ this . editVersion ++ ;
589+ try {
590+ let colorizationState : ColorizationState = this . getColorizationState ( textDocumentChangeEvent . document . uri . toString ( ) ) ;
590591
591- // Adjust colorization ranges after this edit. (i.e. if a line was added, push decorations after it down one line)
592- colorizationState . updateAfterEdits ( textDocumentChangeEvent . contentChanges , this . editVersion ) ;
593- } catch ( e ) {
594- // Ensure an exception does not prevent pass-through to native handler, or editVersion could become inconsistent
595- console . log ( e . toString ( ) ) ;
592+ // Adjust colorization ranges after this edit. (i.e. if a line was added, push decorations after it down one line)
593+ colorizationState . updateAfterEdits ( textDocumentChangeEvent . contentChanges , this . editVersion ) ;
594+ } catch ( e ) {
595+ // Ensure an exception does not prevent pass-through to native handler, or editVersion could become inconsistent
596+ console . log ( e . toString ( ) ) ;
597+ }
596598 }
597599 }
598600 }
599601
600602 public onDidOpenTextDocument ( document : vscode . TextDocument ) : void {
601- this . sendVisibleRanges ( document . uri ) ;
603+ if ( document . uri . scheme === "file" ) {
604+ this . sendVisibleRanges ( document . uri ) ;
605+ }
602606 }
603607
604608 public onDidChangeVisibleTextEditors ( editors : vscode . TextEditor [ ] ) : void {
605609 let processedUris : vscode . Uri [ ] = [ ] ;
606610 editors . forEach ( editor => {
607- let colorizationState : ColorizationState = this . colorizationState . get ( editor . document . uri . toString ( ) ) ;
608- if ( colorizationState ) {
609- colorizationState . refresh ( editor ) ;
610- }
611- if ( ! processedUris . find ( uri => uri === editor . document . uri ) ) {
612- processedUris . push ( editor . document . uri ) ;
613- this . sendVisibleRanges ( editor . document . uri ) ;
611+ if ( editor . document . uri . scheme === "file" ) {
612+ let colorizationState : ColorizationState = this . colorizationState . get ( editor . document . uri . toString ( ) ) ;
613+ if ( colorizationState ) {
614+ colorizationState . refresh ( editor ) ;
615+ }
616+ if ( ! processedUris . find ( uri => uri === editor . document . uri ) ) {
617+ processedUris . push ( editor . document . uri ) ;
618+ this . sendVisibleRanges ( editor . document . uri ) ;
619+ }
614620 }
615621 } ) ;
616622 }
@@ -650,7 +656,9 @@ class DefaultClient implements Client {
650656 }
651657
652658 public onDidChangeTextEditorVisibleRanges ( textEditorVisibleRangesChangeEvent : vscode . TextEditorVisibleRangesChangeEvent ) : void {
653- this . sendVisibleRanges ( textEditorVisibleRangesChangeEvent . textEditor . document . uri ) ;
659+ if ( textEditorVisibleRangesChangeEvent . textEditor . document . uri . scheme === "file" ) {
660+ this . sendVisibleRanges ( textEditorVisibleRangesChangeEvent . textEditor . document . uri ) ;
661+ }
654662 }
655663
656664 public onRegisterCustomConfigurationProvider ( provider : CustomConfigurationProvider1 ) : Thenable < void > {
0 commit comments