From 103b2dac95c9071f4bfa8e8408ce9ccc364b7a88 Mon Sep 17 00:00:00 2001 From: Jacob Dufault Date: Thu, 13 Apr 2017 01:31:25 -0700 Subject: [PATCH] Fix querydb import overriding good data with bad --- src/command_line.cc | 3 +-- src/query.cc | 9 +++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/command_line.cc b/src/command_line.cc index aa27dbad..f38b7f19 100644 --- a/src/command_line.cc +++ b/src/command_line.cc @@ -859,7 +859,6 @@ void QueryDbMainLoop( // - start at spelling but end at extent for better mouse tooltip // - goto declaration while in definition of recursive type - // TODO: Goto definition broken on Buffer::CreateSharedBuffer. optional def_loc = GetDefinitionSpellingOfSymbol(db, ref.idx); // We use spelling start and extent end because this causes vscode @@ -889,7 +888,7 @@ void QueryDbMainLoop( if (def_loc) PushBack(&response.result, GetLsLocation(db, working_files, *def_loc)); - + if (!response.result.empty()) break; } diff --git a/src/query.cc b/src/query.cc index 9b3cbf3b..1eb9e931 100644 --- a/src/query.cc +++ b/src/query.cc @@ -638,6 +638,9 @@ void QueryableDatabase::ImportOrUpdate(const std::vectorsecond.idx]; + if (existing.def.definition_spelling && !def.definition_spelling) + continue; + existing.def = def; SetQualifiedNameForWorkspaceSearch(this, &existing.qualified_name_idx, SymbolKind::Type, it->second.idx, def.qualified_name); } @@ -652,6 +655,9 @@ void QueryableDatabase::ImportOrUpdate(const std::vectorsecond.idx]; + if (existing.def.definition_spelling && !def.definition_spelling) + continue; + existing.def = def; SetQualifiedNameForWorkspaceSearch(this, &existing.qualified_name_idx, SymbolKind::Func, it->second.idx, def.qualified_name); } @@ -666,6 +672,9 @@ void QueryableDatabase::ImportOrUpdate(const std::vectorsecond.idx]; + if (existing.def.definition_spelling && !def.definition_spelling) + continue; + existing.def = def; if (def.declaring_type) SetQualifiedNameForWorkspaceSearch(this, &existing.qualified_name_idx, SymbolKind::Var, it->second.idx, def.qualified_name);