File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -89,6 +89,16 @@ export abstract class FilePathDiscovery<T extends PathData> extends Discovery {
8989 existingData : T ,
9090 ) : boolean ;
9191
92+ /**
93+ * Update the data for every path by calling `getDataForPath`.
94+ */
95+ protected async recomputeAllData ( ) {
96+ this . pathData = await Promise . all (
97+ this . pathData . map ( ( p ) => this . getDataForPath ( p . path ) ) ,
98+ ) ;
99+ this . onDidChangePathDataEmitter . fire ( ) ;
100+ }
101+
92102 /**
93103 * Do the initial scan of the entire workspace and set up watchers for future changes.
94104 */
Original file line number Diff line number Diff line change @@ -39,7 +39,7 @@ export class QueryDiscovery
3939
4040 this . push (
4141 this . queryPackDiscovery . onDidChangeQueryPacks (
42- this . recomputeAllQueryLanguages . bind ( this ) ,
42+ this . recomputeAllData . bind ( this ) ,
4343 ) ,
4444 ) ;
4545 }
@@ -103,15 +103,6 @@ export class QueryDiscovery
103103 return newData . language !== existingData . language ;
104104 }
105105
106- private recomputeAllQueryLanguages ( ) {
107- // All we know is that something has changed in the set of known query packs.
108- // We have no choice but to recompute the language for all queries.
109- for ( const query of this . pathData ) {
110- query . language = this . determineQueryLanguage ( query . path ) ;
111- }
112- this . onDidChangePathDataEmitter . fire ( ) ;
113- }
114-
115106 private determineQueryLanguage ( path : string ) : QueryLanguage | undefined {
116107 return this . queryPackDiscovery . getLanguageForQueryFile ( path ) ;
117108 }
You can’t perform that action at this time.
0 commit comments