-
Notifications
You must be signed in to change notification settings - Fork 274
Random changes. #6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -71,6 +71,13 @@ bool Indexer_Parse(DiagnosticsEngine* diag_engine, | |
| auto& request = *opt_request; | ||
| ICacheManager cache; | ||
|
|
||
| // dummy one to trigger refresh semantic highlight | ||
| if (request.path.empty()) { | ||
| queue->on_indexed.PushBack( | ||
| Index_OnIndexed(IndexUpdate{}, PerformanceImportFile()), false); | ||
| return false; | ||
| } | ||
|
|
||
| Project::Entry entry; | ||
| { | ||
| std::lock_guard<std::mutex> lock(project->mutex_); | ||
|
|
@@ -216,6 +223,18 @@ void QueryDb_OnIndexed(QueueManager* queue, | |
| SemanticHighlightSymbolCache* semantic_cache, | ||
| WorkingFiles* working_files, | ||
| Index_OnIndexed* response) { | ||
|
|
||
| if (response->update.file_id < 0) { // dummy | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Semantic highlighting does work reliably when the project is still loading. This is because switch (sym.kind) {
case SymbolKind::Func: {
const QueryFunc& func = db->GetFunc(sym);
const QueryFunc::Def* def = func.AnyDef(); ///////// definition required, declaration is ignored
if (!def)
continue; // applies to for loopFunctions defined outside of the current file may not be colored correctly. I occasionally observe that some files are not highlighted, but I am unable to narrow it down (does not look like a forward-line out-of-range error) I'll try this patch tomorrow on LLVM |
||
| LOG_S(INFO) << "Loaded project. Refresh semantic highlight for all working file."; | ||
| std::lock_guard<std::mutex> lock(working_files->files_mutex); | ||
| for (auto& f : working_files->files) { | ||
| int file_id = db->name2file_id[LowerPathIfInsensitive(f->filename)]; | ||
| QueryFile* file = &db->files[file_id]; | ||
| EmitSemanticHighlighting(db, semantic_cache, f.get(), file); | ||
| } | ||
| return; | ||
| } | ||
|
|
||
| Timer time; | ||
| db->ApplyIndexUpdate(&response->update); | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -106,8 +106,8 @@ void IncludeComplete::Rescan() { | |
| SetThreadName("scan_includes"); | ||
| Timer timer; | ||
|
|
||
| InsertIncludesFromDirectory(g_config->projectRoot, | ||
| false /*use_angle_brackets*/); | ||
| // InsertIncludesFromDirectory(g_config->projectRoot, | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This can just be removed. (I didn't even notice this because I don't use include completion much) |
||
| // false /*use_angle_brackets*/); | ||
| for (const std::string& dir : project_->quote_include_directories) | ||
| InsertIncludesFromDirectory(dir, false /*use_angle_brackets*/); | ||
| for (const std::string& dir : project_->angle_include_directories) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -510,12 +510,9 @@ struct Handler_Initialize : BaseMessageHandler<In_InitializeRequest> { | |
| // Start indexer threads. Start this after loading the project, as that | ||
| // may take a long time. Indexer threads will emit status/progress | ||
| // reports. | ||
| if (g_config->index.threads == 0) { | ||
| // If the user has not specified how many indexers to run, try to | ||
| // guess an appropriate value. Default to 80% utilization. | ||
| g_config->index.threads = | ||
| std::max(int(std::thread::hardware_concurrency() * 0.8), 1); | ||
| } | ||
| if (g_config->index.threads == 0) | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is great! |
||
| g_config->index.threads = std::thread::hardware_concurrency(); | ||
|
|
||
| LOG_S(INFO) << "Starting " << g_config->index.threads << " indexers"; | ||
| for (int i = 0; i < g_config->index.threads; i++) { | ||
| std::thread([=]() { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -563,6 +563,9 @@ void Project::Index(QueueManager* queue, | |
| queue->index_request.PushBack(Index_Request(entry.filename, entry.args, | ||
| is_interactive, *content, id)); | ||
| }); | ||
| // dummy request to indicate that project is loaded and | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit. Capitalize. |
||
| // trigger refreshing semantic highlight for all working files | ||
| queue->index_request.PushBack(Index_Request("", {}, false, "")); | ||
| } | ||
|
|
||
| TEST_SUITE("Project") { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what problem does this check solve?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should fix wrong spell name highlight for aliased namespace. For example,
namespace fs = std::experimental::filesysteminfilesystem.hh.7:11-7:13are also highlighted in other files.