Fix querydb import overriding good data with bad

This commit is contained in:
Jacob Dufault 2017-04-13 01:31:25 -07:00
parent 151505dadf
commit 103b2dac95
2 changed files with 10 additions and 2 deletions

View File

@ -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<QueryableLocation> def_loc = GetDefinitionSpellingOfSymbol(db, ref.idx);
// We use spelling start and extent end because this causes vscode

View File

@ -638,6 +638,9 @@ void QueryableDatabase::ImportOrUpdate(const std::vector<QueryableTypeDef::DefUp
assert(it != usr_to_symbol.end());
QueryableTypeDef& existing = types[it->second.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::vector<QueryableFuncDef::DefUp
assert(it != usr_to_symbol.end());
QueryableFuncDef& existing = funcs[it->second.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::vector<QueryableVarDef::DefUpd
assert(it != usr_to_symbol.end());
QueryableVarDef& existing = vars[it->second.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);