mirror of
https://github.com/MaskRay/ccls.git
synced 2025-01-19 03:55:49 +00:00
Fix file_id. (#8)
This commit is contained in:
parent
888a870c0d
commit
4797401d55
@ -71,10 +71,12 @@ bool Indexer_Parse(DiagnosticsEngine* diag_engine,
|
|||||||
auto& request = *opt_request;
|
auto& request = *opt_request;
|
||||||
ICacheManager cache;
|
ICacheManager cache;
|
||||||
|
|
||||||
// dummy one to trigger refresh semantic highlight
|
// Dummy one to trigger refresh semantic highlight.
|
||||||
if (request.path.empty()) {
|
if (request.path.empty()) {
|
||||||
|
IndexUpdate dummy;
|
||||||
|
dummy.refresh = true;
|
||||||
queue->on_indexed.PushBack(
|
queue->on_indexed.PushBack(
|
||||||
Index_OnIndexed(IndexUpdate{}, PerformanceImportFile()), false);
|
Index_OnIndexed(std::move(dummy), PerformanceImportFile()), false);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -224,12 +226,14 @@ void QueryDb_OnIndexed(QueueManager* queue,
|
|||||||
WorkingFiles* working_files,
|
WorkingFiles* working_files,
|
||||||
Index_OnIndexed* response) {
|
Index_OnIndexed* response) {
|
||||||
|
|
||||||
if (response->update.file_id < 0) { // dummy
|
if (response->update.refresh) {
|
||||||
LOG_S(INFO) << "Loaded project. Refresh semantic highlight for all working file.";
|
LOG_S(INFO) << "Loaded project. Refresh semantic highlight for all working file.";
|
||||||
std::lock_guard<std::mutex> lock(working_files->files_mutex);
|
std::lock_guard<std::mutex> lock(working_files->files_mutex);
|
||||||
for (auto& f : working_files->files) {
|
for (auto& f : working_files->files) {
|
||||||
int file_id = db->name2file_id[LowerPathIfInsensitive(f->filename)];
|
std::string filename = LowerPathIfInsensitive(f->filename);
|
||||||
QueryFile* file = &db->files[file_id];
|
if (db->name2file_id.find(filename) == db->name2file_id.end())
|
||||||
|
continue;
|
||||||
|
QueryFile* file = &db->files[db->name2file_id[filename]];
|
||||||
EmitSemanticHighlighting(db, semantic_cache, f.get(), file);
|
EmitSemanticHighlighting(db, semantic_cache, f.get(), file);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
@ -106,8 +106,6 @@ void IncludeComplete::Rescan() {
|
|||||||
SetThreadName("scan_includes");
|
SetThreadName("scan_includes");
|
||||||
Timer timer;
|
Timer timer;
|
||||||
|
|
||||||
// InsertIncludesFromDirectory(g_config->projectRoot,
|
|
||||||
// false /*use_angle_brackets*/);
|
|
||||||
for (const std::string& dir : project_->quote_include_directories)
|
for (const std::string& dir : project_->quote_include_directories)
|
||||||
InsertIncludesFromDirectory(dir, false /*use_angle_brackets*/);
|
InsertIncludesFromDirectory(dir, false /*use_angle_brackets*/);
|
||||||
for (const std::string& dir : project_->angle_include_directories)
|
for (const std::string& dir : project_->angle_include_directories)
|
||||||
|
@ -563,8 +563,8 @@ void Project::Index(QueueManager* queue,
|
|||||||
queue->index_request.PushBack(Index_Request(entry.filename, entry.args,
|
queue->index_request.PushBack(Index_Request(entry.filename, entry.args,
|
||||||
is_interactive, *content, id));
|
is_interactive, *content, id));
|
||||||
});
|
});
|
||||||
// dummy request to indicate that project is loaded and
|
// Dummy request to indicate that project is loaded and
|
||||||
// trigger refreshing semantic highlight for all working files
|
// trigger refreshing semantic highlight for all working files.
|
||||||
queue->index_request.PushBack(Index_Request("", {}, false, ""));
|
queue->index_request.PushBack(Index_Request("", {}, false, ""));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -99,7 +99,10 @@ struct IndexUpdate {
|
|||||||
static IndexUpdate CreateDelta(IndexFile* previous,
|
static IndexUpdate CreateDelta(IndexFile* previous,
|
||||||
IndexFile* current);
|
IndexFile* current);
|
||||||
|
|
||||||
int file_id = -1;
|
int file_id;
|
||||||
|
|
||||||
|
// Dummy one to refresh all semantic highlight.
|
||||||
|
bool refresh = false;
|
||||||
|
|
||||||
// File updates.
|
// File updates.
|
||||||
std::optional<std::string> files_removed;
|
std::optional<std::string> files_removed;
|
||||||
|
Loading…
Reference in New Issue
Block a user