From 787c06e26e5d1e7f5d076dc6668cdf4048dba137 Mon Sep 17 00:00:00 2001 From: Deok Koo Kim Date: Thu, 27 Jun 2019 22:50:25 +0900 Subject: [PATCH] Caller Hiearchy shows lines of each reference in caller, not start line of caller --- src/messages/ccls_call.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/messages/ccls_call.cc b/src/messages/ccls_call.cc index a2a221d4..b6868243 100644 --- a/src/messages/ccls_call.cc +++ b/src/messages/ccls_call.cc @@ -79,14 +79,14 @@ bool Expand(MessageHandler *m, Out_cclsCall *entry, bool callee, entry->numChildren = 0; if (!def) return false; - auto handle = [&](SymbolRef sym, int file_id, CallType call_type1) { + auto handle = [&](SymbolRef sym, Use use, CallType call_type1) { entry->numChildren++; if (levels > 0) { Out_cclsCall entry1; entry1.id = std::to_string(sym.usr); entry1.usr = sym.usr; if (auto loc = GetLsLocation(m->db, m->wfiles, - Use{{sym.range, sym.role}, file_id})) + use)) entry1.location = *loc; entry1.callType = call_type1; if (Expand(m, &entry1, callee, call_type, qualified, levels - 1)) @@ -98,7 +98,7 @@ bool Expand(MessageHandler *m, Out_cclsCall *entry, bool callee, if (const auto *def = func.AnyDef()) for (SymbolRef sym : def->callees) if (sym.kind == Kind::Func) - handle(sym, def->file_id, call_type); + handle(sym, Use{{sym.range, sym.role}, def->file_id}, call_type); } else { for (Use use : func.uses) { const QueryFile &file1 = m->db->files[use.file_id]; @@ -110,7 +110,7 @@ bool Expand(MessageHandler *m, Out_cclsCall *entry, bool callee, (!best || best->extent.start < sym.extent.start)) best = sym; if (best) - handle(*best, use.file_id, call_type); + handle(*best, use, call_type); } } };