mirror of
https://github.com/MaskRay/ccls.git
synced 2024-11-22 15:45:08 +00:00
Disable real-time indexing.
It adds a bit too much latency to code completion. I suspect this can be removed by running real-time indexing in a separate thread (though this will require a dedicated CXTranslationUnit instance).
This commit is contained in:
parent
7531a0b4e5
commit
6704049e13
@ -462,10 +462,12 @@ void CompletionQueryMain(ClangCompleteManager* completion_manager) {
|
|||||||
completion_manager->on_diagnostic_(session->file.filename,
|
completion_manager->on_diagnostic_(session->file.filename,
|
||||||
ls_diagnostics);
|
ls_diagnostics);
|
||||||
|
|
||||||
|
/*
|
||||||
timer.Reset();
|
timer.Reset();
|
||||||
completion_manager->on_index_(session->tu.get(), unsaved,
|
completion_manager->on_index_(session->tu.get(), unsaved,
|
||||||
session->file.filename, session->file.args);
|
session->file.filename, session->file.args);
|
||||||
timer.ResetAndPrint("[complete] Reindex file");
|
timer.ResetAndPrint("[complete] Reindex file");
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
@ -578,9 +580,11 @@ void ClangCompleteManager::NotifyView(const std::string& filename) {
|
|||||||
|
|
||||||
std::lock_guard<std::mutex> lock(sessions_lock_);
|
std::lock_guard<std::mutex> lock(sessions_lock_);
|
||||||
|
|
||||||
|
// Already a view session, do nothing.
|
||||||
if (view_sessions_.TryGetEntry(filename))
|
if (view_sessions_.TryGetEntry(filename))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
// Create new view session.
|
||||||
view_sessions_.InsertEntry(std::make_shared<CompletionSession>(
|
view_sessions_.InsertEntry(std::make_shared<CompletionSession>(
|
||||||
project_->FindCompilationEntryForFile(filename), working_files_));
|
project_->FindCompilationEntryForFile(filename), working_files_));
|
||||||
parse_requests_.Enqueue(ParseRequest(filename));
|
parse_requests_.Enqueue(ParseRequest(filename));
|
||||||
@ -598,15 +602,18 @@ void ClangCompleteManager::NotifyEdit(const std::string& filename) {
|
|||||||
if (edit_sessions_.TryGetEntry(filename))
|
if (edit_sessions_.TryGetEntry(filename))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
std::shared_ptr<CompletionSession> session =
|
// Move the session from view to edit.
|
||||||
|
std::shared_ptr<CompletionSession> view_session =
|
||||||
view_sessions_.TryTakeEntry(filename);
|
view_sessions_.TryTakeEntry(filename);
|
||||||
if (session) {
|
if (view_session) {
|
||||||
edit_sessions_.InsertEntry(session);
|
edit_sessions_.InsertEntry(view_session);
|
||||||
} else {
|
return;
|
||||||
edit_sessions_.InsertEntry(std::make_shared<CompletionSession>(
|
|
||||||
project_->FindCompilationEntryForFile(filename), working_files_));
|
|
||||||
parse_requests_.PriorityEnqueue(ParseRequest(filename));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// No view session, create a new session.
|
||||||
|
edit_sessions_.InsertEntry(std::make_shared<CompletionSession>(
|
||||||
|
project_->FindCompilationEntryForFile(filename), working_files_));
|
||||||
|
parse_requests_.PriorityEnqueue(ParseRequest(filename));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClangCompleteManager::NotifySave(const std::string& filename) {
|
void ClangCompleteManager::NotifySave(const std::string& filename) {
|
||||||
|
Loading…
Reference in New Issue
Block a user