mirror of
https://github.com/MaskRay/ccls.git
synced 2024-11-23 16:15:07 +00:00
hierarchicalDocumentSymbol: display member function declarations
This commit is contained in:
parent
c84895e39d
commit
6283f7e919
@ -162,21 +162,20 @@ void MessageHandler::textDocument_documentSymbol(Reader &reader,
|
|||||||
continue;
|
continue;
|
||||||
auto &ds = r.first->second;
|
auto &ds = r.first->second;
|
||||||
ds = std::make_unique<DocumentSymbol>();
|
ds = std::make_unique<DocumentSymbol>();
|
||||||
|
if (auto range = GetLsRange(wfile, sym.range)) {
|
||||||
|
ds->selectionRange = *range;
|
||||||
|
ds->range = ds->selectionRange;
|
||||||
|
if (sym.extent.Valid())
|
||||||
|
if (auto range1 = GetLsRange(wfile, sym.extent))
|
||||||
|
ds->range = *range1;
|
||||||
|
}
|
||||||
std::vector<const void *> def_ptrs;
|
std::vector<const void *> def_ptrs;
|
||||||
WithEntity(db, sym, [&, sym = sym](const auto &entity) {
|
WithEntity(db, sym, [&](const auto &entity) {
|
||||||
auto *def = entity.AnyDef();
|
auto *def = entity.AnyDef();
|
||||||
if (!def)
|
if (!def)
|
||||||
return;
|
return;
|
||||||
ds->name = def->Name(false);
|
ds->name = def->Name(false);
|
||||||
ds->detail = def->Name(true);
|
ds->detail = def->Name(true);
|
||||||
if (auto ls_range = GetLsRange(wfile, sym.range)) {
|
|
||||||
ds->selectionRange = *ls_range;
|
|
||||||
ds->range = ds->selectionRange;
|
|
||||||
if (sym.extent.Valid())
|
|
||||||
if (auto ls_range1 = GetLsRange(wfile, sym.extent))
|
|
||||||
ds->range = *ls_range1;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (auto &def : entity.def)
|
for (auto &def : entity.def)
|
||||||
if (def.file_id == file_id && !Ignore(&def)) {
|
if (def.file_id == file_id && !Ignore(&def)) {
|
||||||
ds->kind = def.kind;
|
ds->kind = def.kind;
|
||||||
@ -184,11 +183,14 @@ void MessageHandler::textDocument_documentSymbol(Reader &reader,
|
|||||||
def_ptrs.push_back(&def);
|
def_ptrs.push_back(&def);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (def_ptrs.empty() || !(param.all || sym.role & Role::Definition ||
|
if (!(param.all || sym.role & Role::Definition ||
|
||||||
|
ds->kind == SymbolKind::Method ||
|
||||||
ds->kind == SymbolKind::Namespace)) {
|
ds->kind == SymbolKind::Namespace)) {
|
||||||
ds.reset();
|
ds.reset();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (def_ptrs.empty())
|
||||||
|
continue;
|
||||||
if (sym.kind == Kind::Func)
|
if (sym.kind == Kind::Func)
|
||||||
funcs.emplace_back(std::move(def_ptrs), ds.get());
|
funcs.emplace_back(std::move(def_ptrs), ds.get());
|
||||||
else if (sym.kind == Kind::Type)
|
else if (sym.kind == Kind::Type)
|
||||||
|
Loading…
Reference in New Issue
Block a user