mirror of
https://github.com/MaskRay/ccls.git
synced 2024-11-22 07:35: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,
|
||||
ls_diagnostics);
|
||||
|
||||
/*
|
||||
timer.Reset();
|
||||
completion_manager->on_index_(session->tu.get(), unsaved,
|
||||
session->file.filename, session->file.args);
|
||||
timer.ResetAndPrint("[complete] Reindex file");
|
||||
*/
|
||||
}
|
||||
|
||||
continue;
|
||||
@ -578,9 +580,11 @@ void ClangCompleteManager::NotifyView(const std::string& filename) {
|
||||
|
||||
std::lock_guard<std::mutex> lock(sessions_lock_);
|
||||
|
||||
// Already a view session, do nothing.
|
||||
if (view_sessions_.TryGetEntry(filename))
|
||||
return;
|
||||
|
||||
// Create new view session.
|
||||
view_sessions_.InsertEntry(std::make_shared<CompletionSession>(
|
||||
project_->FindCompilationEntryForFile(filename), working_files_));
|
||||
parse_requests_.Enqueue(ParseRequest(filename));
|
||||
@ -598,15 +602,18 @@ void ClangCompleteManager::NotifyEdit(const std::string& filename) {
|
||||
if (edit_sessions_.TryGetEntry(filename))
|
||||
return;
|
||||
|
||||
std::shared_ptr<CompletionSession> session =
|
||||
// Move the session from view to edit.
|
||||
std::shared_ptr<CompletionSession> view_session =
|
||||
view_sessions_.TryTakeEntry(filename);
|
||||
if (session) {
|
||||
edit_sessions_.InsertEntry(session);
|
||||
} else {
|
||||
edit_sessions_.InsertEntry(std::make_shared<CompletionSession>(
|
||||
project_->FindCompilationEntryForFile(filename), working_files_));
|
||||
parse_requests_.PriorityEnqueue(ParseRequest(filename));
|
||||
if (view_session) {
|
||||
edit_sessions_.InsertEntry(view_session);
|
||||
return;
|
||||
}
|
||||
|
||||
// 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) {
|
||||
|
Loading…
Reference in New Issue
Block a user