@@ -43,7 +43,7 @@ export class SelectorCompletionItemProvider implements CompletionItemProvider, D
4343 this . files . clear ( ) ;
4444 }
4545
46- watchFile ( path : string , listener : ( e : Uri ) => any ) {
46+ watchFile ( path : string , listener : ( ) => any ) {
4747 if ( this . watchers . has ( path ) ) {
4848 return ;
4949 }
@@ -194,19 +194,21 @@ export class SelectorCompletionItemProvider implements CompletionItemProvider, D
194194
195195 let text = this . files . get ( path ) ;
196196
197- try {
198- if ( ! text ) {
197+ if ( ! text ) {
198+ try {
199199 text = ( await workspace . fs . readFile ( file ) ) . toString ( ) ;
200- this . files . set ( path , text ) ;
201- this . watchFile ( path , ( ) => this . files . delete ( path ) ) ;
200+ } catch ( error ) {
201+ text = "" ;
202202 }
203203
204- this . findEmbedded ( file , keys , text ) ;
205-
206- await this . findLinks ( file , keys , text ) ;
207- await this . findInherited ( file , keys , text , level ) ;
208- } catch ( error ) {
204+ this . files . set ( path , text ) ;
205+ this . watchFile ( path , ( ) => this . files . delete ( path ) ) ;
209206 }
207+
208+ this . findEmbedded ( file , keys , text ) ;
209+
210+ await this . findLinks ( file , keys , text ) ;
211+ await this . findInherited ( file , keys , text , level ) ;
210212 }
211213 }
212214
0 commit comments