mirror of
https://github.com/MaskRay/ccls.git
synced 2024-11-22 23:55:08 +00:00
Use call sites for callHierarchy
This commit is contained in:
parent
1cc5b85ef4
commit
8e70a1078e
@ -167,7 +167,8 @@ void EmitSemanticHighlighting(QueryDatabase* db,
|
|||||||
if (start_line >= 0 && start_line < working_file->index_lines.size()) {
|
if (start_line >= 0 && start_line < working_file->index_lines.size()) {
|
||||||
std::string_view line = working_file->index_lines[start_line];
|
std::string_view line = working_file->index_lines[start_line];
|
||||||
sym.range.end.line = start_line;
|
sym.range.end.line = start_line;
|
||||||
if (line.compare(start_col, concise_name.size(), concise_name) == 0)
|
if (start_col + concise_name.size() <= line.size() &&
|
||||||
|
line.compare(start_col, concise_name.size(), concise_name) == 0)
|
||||||
sym.range.end.column = start_col + concise_name.size();
|
sym.range.end.column = start_col + concise_name.size();
|
||||||
else
|
else
|
||||||
continue; // applies to for loop
|
continue; // applies to for loop
|
||||||
|
@ -84,6 +84,8 @@ bool Expand(MessageHandler* m,
|
|||||||
if (levels > 0) {
|
if (levels > 0) {
|
||||||
Out_CqueryCallHierarchy::Entry entry1;
|
Out_CqueryCallHierarchy::Entry entry1;
|
||||||
entry1.id = QueryFuncId(use.id);
|
entry1.id = QueryFuncId(use.id);
|
||||||
|
if (auto loc = GetLsLocation(m->db, m->working_files, use))
|
||||||
|
entry1.location = *loc;
|
||||||
entry1.callType = call_type;
|
entry1.callType = call_type;
|
||||||
if (Expand(m, &entry1, callee, call_type, detailed_name, levels - 1))
|
if (Expand(m, &entry1, callee, call_type, detailed_name, levels - 1))
|
||||||
entry->children.push_back(std::move(entry1));
|
entry->children.push_back(std::move(entry1));
|
||||||
@ -109,11 +111,6 @@ bool Expand(MessageHandler* m,
|
|||||||
entry->name = def->detailed_name;
|
entry->name = def->detailed_name;
|
||||||
else
|
else
|
||||||
entry->name = def->ShortName();
|
entry->name = def->ShortName();
|
||||||
if (def->spell) {
|
|
||||||
if (optional<lsLocation> loc =
|
|
||||||
GetLsLocation(m->db, m->working_files, *def->spell))
|
|
||||||
entry->location = *loc;
|
|
||||||
}
|
|
||||||
handle_uses(func, CallType::Direct);
|
handle_uses(func, CallType::Direct);
|
||||||
|
|
||||||
// Callers/callees of base functions.
|
// Callers/callees of base functions.
|
||||||
@ -166,6 +163,11 @@ struct CqueryCallHierarchyHandler
|
|||||||
Out_CqueryCallHierarchy::Entry entry;
|
Out_CqueryCallHierarchy::Entry entry;
|
||||||
entry.id = root_id;
|
entry.id = root_id;
|
||||||
entry.callType = CallType::Direct;
|
entry.callType = CallType::Direct;
|
||||||
|
if (def->spell) {
|
||||||
|
if (optional<lsLocation> loc =
|
||||||
|
GetLsLocation(db, working_files, *def->spell))
|
||||||
|
entry.location = *loc;
|
||||||
|
}
|
||||||
Expand(this, &entry, callee, call_type, detailed_name, levels);
|
Expand(this, &entry, callee, call_type, detailed_name, levels);
|
||||||
return entry;
|
return entry;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user