@@ -10,25 +10,26 @@ import * as path from 'path';
1010import { Repository , GitResourceGroup , Status } from './repository' ;
1111import { Model } from './model' ;
1212import { debounce } from './decorators' ;
13- import { filterEvent , dispose } from './util' ;
13+ import { filterEvent , dispose , anyEvent , mapEvent , fireEvent } from './util' ;
1414import { Submodule , GitErrorCodes } from './git' ;
1515
1616type Callback = { resolve : ( status : boolean ) => void , reject : ( err : any ) => void } ;
1717
1818class GitIgnoreDecorationProvider implements DecorationProvider {
1919
20- private readonly _onDidChangeDecorations = new EventEmitter < Uri [ ] > ( ) ;
21- readonly onDidChangeDecorations : Event < Uri [ ] > = this . _onDidChangeDecorations . event ;
22-
20+ readonly onDidChangeDecorations : Event < Uri [ ] > ;
2321 private queue = new Map < string , { repository : Repository ; queue : Map < string , Callback > ; } > ( ) ;
2422 private disposables : Disposable [ ] = [ ] ;
2523
2624 constructor ( private model : Model ) {
27- this . disposables . push (
28- window . registerDecorationProvider ( this ) ,
29- filterEvent ( workspace . onDidSaveTextDocument , e => e . fileName . endsWith ( '.gitignore' ) ) ( _ => this . _onDidChangeDecorations . fire ( ) )
30- //todo@joh -> events when the ignore status actually changes, not only when the file changes
31- ) ;
25+ //todo@joh -> events when the ignore status actually changes, not only when the file changes
26+ this . onDidChangeDecorations = fireEvent ( anyEvent < any > (
27+ filterEvent ( workspace . onDidSaveTextDocument , e => e . fileName . endsWith ( '.gitignore' ) ) ,
28+ model . onDidOpenRepository ,
29+ model . onDidCloseRepository
30+ ) ) ;
31+
32+ this . disposables . push ( window . registerDecorationProvider ( this ) ) ;
3233 }
3334
3435 provideDecoration ( uri : Uri ) : Promise < DecorationData | undefined > {
0 commit comments