mirror of
https://github.com/MaskRay/ccls.git
synced 2024-11-24 00:25:07 +00:00
Add flat to $ccls/inheritanceHierarchy
This commit is contained in:
parent
3931951406
commit
b9e1c2ee07
@ -1,8 +1,9 @@
|
|||||||
#include "message_handler.h"
|
#include "message_handler.h"
|
||||||
#include "query_utils.h"
|
|
||||||
#include "pipeline.hh"
|
#include "pipeline.hh"
|
||||||
|
#include "query_utils.h"
|
||||||
using namespace ccls;
|
using namespace ccls;
|
||||||
|
|
||||||
|
#include <queue>
|
||||||
#include <unordered_set>
|
#include <unordered_set>
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
@ -24,18 +25,12 @@ struct In_CclsInheritanceHierarchy : public RequestInMessage {
|
|||||||
bool derived = false;
|
bool derived = false;
|
||||||
bool qualified = true;
|
bool qualified = true;
|
||||||
int levels = 1;
|
int levels = 1;
|
||||||
};
|
bool flat = false;
|
||||||
Params params;
|
} params;
|
||||||
};
|
};
|
||||||
|
|
||||||
MAKE_REFLECT_STRUCT(In_CclsInheritanceHierarchy::Params,
|
MAKE_REFLECT_STRUCT(In_CclsInheritanceHierarchy::Params, textDocument, position,
|
||||||
textDocument,
|
id, kind, derived, qualified, levels, flat);
|
||||||
position,
|
|
||||||
id,
|
|
||||||
kind,
|
|
||||||
derived,
|
|
||||||
qualified,
|
|
||||||
levels);
|
|
||||||
MAKE_REFLECT_STRUCT(In_CclsInheritanceHierarchy, id, params);
|
MAKE_REFLECT_STRUCT(In_CclsInheritanceHierarchy, id, params);
|
||||||
REGISTER_IN_MESSAGE(In_CclsInheritanceHierarchy);
|
REGISTER_IN_MESSAGE(In_CclsInheritanceHierarchy);
|
||||||
|
|
||||||
@ -159,7 +154,7 @@ struct Handler_CclsInheritanceHierarchy
|
|||||||
Out_CclsInheritanceHierarchy out;
|
Out_CclsInheritanceHierarchy out;
|
||||||
out.id = request->id;
|
out.id = request->id;
|
||||||
|
|
||||||
if (params.id.size()) {
|
if (!params.flat && params.id.size()) {
|
||||||
try {
|
try {
|
||||||
params.usr = std::stoull(params.id);
|
params.usr = std::stoull(params.id);
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
@ -189,7 +184,26 @@ struct Handler_CclsInheritanceHierarchy
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!params.flat) {
|
||||||
pipeline::WriteStdout(kMethodType, out);
|
pipeline::WriteStdout(kMethodType, out);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Out_LocationList out1;
|
||||||
|
out1.id = request->id;
|
||||||
|
if (out.result) {
|
||||||
|
std::queue<Out_CclsInheritanceHierarchy::Entry *> q;
|
||||||
|
for (auto &entry1 : out.result->children)
|
||||||
|
q.push(&entry1);
|
||||||
|
while (q.size()) {
|
||||||
|
auto *entry = q.front();
|
||||||
|
q.pop();
|
||||||
|
if (entry->location.uri.raw_uri.size())
|
||||||
|
out1.result.push_back({entry->location});
|
||||||
|
for (auto &entry1 : entry->children)
|
||||||
|
q.push(&entry1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
pipeline::WriteStdout(kMethodType, out1);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
REGISTER_MESSAGE_HANDLER(Handler_CclsInheritanceHierarchy);
|
REGISTER_MESSAGE_HANDLER(Handler_CclsInheritanceHierarchy);
|
||||||
|
Loading…
Reference in New Issue
Block a user