@@ -786,11 +786,13 @@ class SelectionHighlighterState {
786786 public readonly searchText : string ;
787787 public readonly matchCase : boolean ;
788788 public readonly wordSeparators : string | null ;
789+ public readonly modelVersionId : number ;
789790
790- constructor ( searchText : string , matchCase : boolean , wordSeparators : string | null ) {
791+ constructor ( searchText : string , matchCase : boolean , wordSeparators : string | null , modelVersionId : number ) {
791792 this . searchText = searchText ;
792793 this . matchCase = matchCase ;
793794 this . wordSeparators = wordSeparators ;
795+ this . modelVersionId = modelVersionId ;
794796 }
795797
796798 /**
@@ -807,6 +809,7 @@ class SelectionHighlighterState {
807809 a . searchText === b . searchText
808810 && a . matchCase === b . matchCase
809811 && a . wordSeparators === b . wordSeparators
812+ && a . modelVersionId === b . modelVersionId
810813 ) ;
811814 }
812815}
@@ -857,6 +860,11 @@ export class SelectionHighlighter extends Disposable implements IEditorContribut
857860 this . _register ( editor . onDidChangeModel ( ( e ) => {
858861 this . _setState ( null ) ;
859862 } ) ) ;
863+ this . _register ( editor . onDidChangeModelContent ( ( e ) => {
864+ if ( this . _isEnabled ) {
865+ this . updateSoon . schedule ( ) ;
866+ }
867+ } ) ) ;
860868 this . _register ( CommonFindController . get ( editor ) . getState ( ) . onFindReplaceStateChange ( ( e ) => {
861869 this . _update ( ) ;
862870 } ) ) ;
@@ -939,7 +947,7 @@ export class SelectionHighlighter extends Disposable implements IEditorContribut
939947 }
940948 }
941949
942- return new SelectionHighlighterState ( r . searchText , r . matchCase , r . wholeWord ? editor . getOption ( EditorOption . wordSeparators ) : null ) ;
950+ return new SelectionHighlighterState ( r . searchText , r . matchCase , r . wholeWord ? editor . getOption ( EditorOption . wordSeparators ) : null , editor . getModel ( ) . getVersionId ( ) ) ;
943951 }
944952
945953 private _setState ( state : SelectionHighlighterState | null ) : void {
0 commit comments