@@ -141,7 +141,7 @@ std::unique_ptr<IndexFile> RawCacheLoad(const std::string &path) {
141
141
}
142
142
143
143
bool Indexer_Parse (DiagnosticsPublisher *diag_pub, WorkingFiles *working_files,
144
- Project *project, VFS *vfs) {
144
+ Project *project, VFS *vfs, const GroupMatch &matcher ) {
145
145
std::optional<Index_Request> opt_request = index_request->TryPopFront ();
146
146
if (!opt_request)
147
147
return false ;
@@ -155,6 +155,11 @@ bool Indexer_Parse(DiagnosticsPublisher *diag_pub, WorkingFiles *working_files,
155
155
return false ;
156
156
}
157
157
158
+ if (std::string reason; !matcher.IsMatch (request.path , &reason)) {
159
+ LOG_S (INFO) << " skip " << request.path << " for " << reason;
160
+ return false ;
161
+ }
162
+
158
163
Project::Entry entry;
159
164
{
160
165
std::lock_guard<std::mutex> lock (project->mutex_ );
@@ -247,6 +252,12 @@ bool Indexer_Parse(DiagnosticsPublisher *diag_pub, WorkingFiles *working_files,
247
252
std::string path = curr->path ;
248
253
if (!(vfs->Stamp (path, curr->last_write_time ) || path == path_to_index))
249
254
continue ;
255
+ if (std::string reason; !matcher.IsMatch (path, &reason)) {
256
+ LOG_S (INFO) << " skip emitting and storing index of " << path << " for "
257
+ << reason;
258
+ continue ;
259
+ }
260
+
250
261
LOG_S (INFO) << " emit index for " << path;
251
262
prev = RawCacheLoad (path);
252
263
@@ -295,8 +306,9 @@ void Init() {
295
306
296
307
void Indexer_Main (DiagnosticsPublisher *diag_pub, VFS *vfs, Project *project,
297
308
WorkingFiles *working_files) {
309
+ GroupMatch matcher (g_config->index .whitelist , g_config->index .blacklist );
298
310
while (true )
299
- if (!Indexer_Parse (diag_pub, working_files, project, vfs))
311
+ if (!Indexer_Parse (diag_pub, working_files, project, vfs, matcher ))
300
312
indexer_waiter->Wait (index_request);
301
313
}
302
314
0 commit comments