mirror of
https://github.com/MaskRay/ccls.git
synced 2025-04-15 21:32:13 +00:00
Fix outline and global search for pure virtual methods
This commit is contained in:
parent
12a0db7d10
commit
fdbb820d50
@ -1072,8 +1072,13 @@ void QueryDbMainLoop(
|
|||||||
if (db->qualified_names[i].find(query) != std::string::npos) {
|
if (db->qualified_names[i].find(query) != std::string::npos) {
|
||||||
lsSymbolInformation info = GetSymbolInfo(db, working_files, db->symbols[i]);
|
lsSymbolInformation info = GetSymbolInfo(db, working_files, db->symbols[i]);
|
||||||
optional<QueryableLocation> location = GetDefinitionExtentOfSymbol(db, db->symbols[i]);
|
optional<QueryableLocation> location = GetDefinitionExtentOfSymbol(db, db->symbols[i]);
|
||||||
if (!location)
|
if (!location) {
|
||||||
|
auto decls = GetDeclarationsOfSymbolForGotoDefinition(db, db->symbols[i]);
|
||||||
|
if (decls.empty())
|
||||||
continue;
|
continue;
|
||||||
|
location = decls[0];
|
||||||
|
}
|
||||||
|
|
||||||
optional<lsLocation> ls_location = GetLsLocation(db, working_files, *location);
|
optional<lsLocation> ls_location = GetLsLocation(db, working_files, *location);
|
||||||
if (!ls_location)
|
if (!ls_location)
|
||||||
continue;
|
continue;
|
||||||
|
18
src/query.cc
18
src/query.cc
@ -93,8 +93,8 @@ QueryableFile::Def BuildFileDef(const IdMap& id_map, const IndexedFile& indexed)
|
|||||||
if (def.def.definition_extent.has_value())
|
if (def.def.definition_extent.has_value())
|
||||||
add_outline(id_map.ToSymbol(def.id), def.def.definition_extent.value());
|
add_outline(id_map.ToSymbol(def.id), def.def.definition_extent.value());
|
||||||
for (Range decl : def.declarations) {
|
for (Range decl : def.declarations) {
|
||||||
add_outline(id_map.ToSymbol(def.id), decl);
|
|
||||||
add_all_symbols(id_map.ToSymbol(def.id), decl);
|
add_all_symbols(id_map.ToSymbol(def.id), decl);
|
||||||
|
add_outline(id_map.ToSymbol(def.id), decl);
|
||||||
}
|
}
|
||||||
for (const Range& use : def.uses)
|
for (const Range& use : def.uses)
|
||||||
add_all_symbols(id_map.ToSymbol(def.id), use);
|
add_all_symbols(id_map.ToSymbol(def.id), use);
|
||||||
@ -599,7 +599,7 @@ void IndexUpdate::Merge(const IndexUpdate& update) {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
void UpdateQualifiedName(QueryableDatabase* db, size_t* qualified_name_index, SymbolKind kind, size_t symbol_index, const std::string& name) {
|
void SetQualifiedNameForWorkspaceSearch(QueryableDatabase* db, size_t* qualified_name_index, SymbolKind kind, size_t symbol_index, const std::string& name) {
|
||||||
if (*qualified_name_index == -1) {
|
if (*qualified_name_index == -1) {
|
||||||
db->qualified_names.push_back(name);
|
db->qualified_names.push_back(name);
|
||||||
db->symbols.push_back(SymbolIdx(kind, symbol_index));
|
db->symbols.push_back(SymbolIdx(kind, symbol_index));
|
||||||
@ -628,13 +628,13 @@ void QueryableDatabase::ImportOrUpdate(const std::vector<QueryableFile::DefUpdat
|
|||||||
|
|
||||||
QueryableFile& existing = files[it->second.idx];
|
QueryableFile& existing = files[it->second.idx];
|
||||||
existing.def = def;
|
existing.def = def;
|
||||||
//UpdateQualifiedName(this, &existing.qualified_name_idx, SymbolKind::File, it->second.idx, def.usr);
|
//SetQualifiedNameForWorkspaceSearch(this, &existing.qualified_name_idx, SymbolKind::File, it->second.idx, def.usr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QueryableDatabase::ImportOrUpdate(const std::vector<QueryableTypeDef::DefUpdate>& updates) {
|
void QueryableDatabase::ImportOrUpdate(const std::vector<QueryableTypeDef::DefUpdate>& updates) {
|
||||||
for (auto& def : updates) {
|
for (auto& def : updates) {
|
||||||
if (!def.definition_extent)
|
if (def.qualified_name.empty())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
auto it = usr_to_symbol.find(def.usr);
|
auto it = usr_to_symbol.find(def.usr);
|
||||||
@ -642,13 +642,13 @@ void QueryableDatabase::ImportOrUpdate(const std::vector<QueryableTypeDef::DefUp
|
|||||||
|
|
||||||
QueryableTypeDef& existing = types[it->second.idx];
|
QueryableTypeDef& existing = types[it->second.idx];
|
||||||
existing.def = def;
|
existing.def = def;
|
||||||
UpdateQualifiedName(this, &existing.qualified_name_idx, SymbolKind::Type, it->second.idx, def.usr);
|
SetQualifiedNameForWorkspaceSearch(this, &existing.qualified_name_idx, SymbolKind::Type, it->second.idx, def.usr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QueryableDatabase::ImportOrUpdate(const std::vector<QueryableFuncDef::DefUpdate>& updates) {
|
void QueryableDatabase::ImportOrUpdate(const std::vector<QueryableFuncDef::DefUpdate>& updates) {
|
||||||
for (auto& def : updates) {
|
for (auto& def : updates) {
|
||||||
if (!def.definition_extent)
|
if (def.qualified_name.empty())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
auto it = usr_to_symbol.find(def.usr);
|
auto it = usr_to_symbol.find(def.usr);
|
||||||
@ -656,13 +656,13 @@ void QueryableDatabase::ImportOrUpdate(const std::vector<QueryableFuncDef::DefUp
|
|||||||
|
|
||||||
QueryableFuncDef& existing = funcs[it->second.idx];
|
QueryableFuncDef& existing = funcs[it->second.idx];
|
||||||
existing.def = def;
|
existing.def = def;
|
||||||
UpdateQualifiedName(this, &existing.qualified_name_idx, SymbolKind::Func, it->second.idx, def.usr);
|
SetQualifiedNameForWorkspaceSearch(this, &existing.qualified_name_idx, SymbolKind::Func, it->second.idx, def.usr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QueryableDatabase::ImportOrUpdate(const std::vector<QueryableVarDef::DefUpdate>& updates) {
|
void QueryableDatabase::ImportOrUpdate(const std::vector<QueryableVarDef::DefUpdate>& updates) {
|
||||||
for (auto& def : updates) {
|
for (auto& def : updates) {
|
||||||
if (!def.definition_extent)
|
if (def.qualified_name.empty())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
auto it = usr_to_symbol.find(def.usr);
|
auto it = usr_to_symbol.find(def.usr);
|
||||||
@ -671,7 +671,7 @@ void QueryableDatabase::ImportOrUpdate(const std::vector<QueryableVarDef::DefUpd
|
|||||||
QueryableVarDef& existing = vars[it->second.idx];
|
QueryableVarDef& existing = vars[it->second.idx];
|
||||||
existing.def = def;
|
existing.def = def;
|
||||||
if (def.declaring_type)
|
if (def.declaring_type)
|
||||||
UpdateQualifiedName(this, &existing.qualified_name_idx, SymbolKind::Var, it->second.idx, def.usr);
|
SetQualifiedNameForWorkspaceSearch(this, &existing.qualified_name_idx, SymbolKind::Var, it->second.idx, def.usr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user