mirror of
https://github.com/MaskRay/ccls.git
synced 2024-11-22 07:35:08 +00:00
Uniquify $ccls/inheritanceHierarchy and add flat to $ccls/memberHierarchy
This commit is contained in:
parent
b794b3606f
commit
99fe7c7624
@ -187,6 +187,9 @@ struct Handler_CclsInheritanceHierarchy
|
|||||||
for (auto &entry1 : entry->children)
|
for (auto &entry1 : entry->children)
|
||||||
q.push(&entry1);
|
q.push(&entry1);
|
||||||
}
|
}
|
||||||
|
std::sort(out1.result.begin(), out1.result.end());
|
||||||
|
out1.result.erase(std::unique(out1.result.begin(), out1.result.end()),
|
||||||
|
out1.result.end());
|
||||||
}
|
}
|
||||||
pipeline::WriteStdout(kMethodType, out1);
|
pipeline::WriteStdout(kMethodType, out1);
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,7 @@ using namespace ccls;
|
|||||||
#include <clang/AST/Type.h>
|
#include <clang/AST/Type.h>
|
||||||
using namespace clang;
|
using namespace clang;
|
||||||
|
|
||||||
|
#include <queue>
|
||||||
#include <unordered_set>
|
#include <unordered_set>
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
@ -29,12 +30,12 @@ struct In_CclsMemberHierarchy : public RequestInMessage {
|
|||||||
|
|
||||||
bool qualified = false;
|
bool qualified = false;
|
||||||
int levels = 1;
|
int levels = 1;
|
||||||
};
|
bool flat = false;
|
||||||
Params params;
|
} params;
|
||||||
};
|
};
|
||||||
|
|
||||||
MAKE_REFLECT_STRUCT(In_CclsMemberHierarchy::Params, textDocument, position, id,
|
MAKE_REFLECT_STRUCT(In_CclsMemberHierarchy::Params, textDocument, position, id,
|
||||||
qualified, levels);
|
qualified, levels, flat);
|
||||||
MAKE_REFLECT_STRUCT(In_CclsMemberHierarchy, id, params);
|
MAKE_REFLECT_STRUCT(In_CclsMemberHierarchy, id, params);
|
||||||
REGISTER_IN_MESSAGE(In_CclsMemberHierarchy);
|
REGISTER_IN_MESSAGE(In_CclsMemberHierarchy);
|
||||||
|
|
||||||
@ -264,7 +265,29 @@ struct Handler_CclsMemberHierarchy
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pipeline::WriteStdout(kMethodType, out);
|
if (!params.flat) {
|
||||||
|
pipeline::WriteStdout(kMethodType, out);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Out_LocationList out1;
|
||||||
|
out1.id = request->id;
|
||||||
|
if (out.result) {
|
||||||
|
std::queue<Out_CclsMemberHierarchy::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);
|
||||||
|
}
|
||||||
|
std::sort(out1.result.begin(), out1.result.end());
|
||||||
|
out1.result.erase(std::unique(out1.result.begin(), out1.result.end()),
|
||||||
|
out1.result.end());
|
||||||
|
}
|
||||||
|
pipeline::WriteStdout(kMethodType, out1);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
REGISTER_MESSAGE_HANDLER(Handler_CclsMemberHierarchy);
|
REGISTER_MESSAGE_HANDLER(Handler_CclsMemberHierarchy);
|
||||||
|
@ -142,6 +142,8 @@ struct lsServerCapabilities {
|
|||||||
bool definitionProvider = true;
|
bool definitionProvider = true;
|
||||||
// The server provides Goto Type Definition support.
|
// The server provides Goto Type Definition support.
|
||||||
bool typeDefinitionProvider = true;
|
bool typeDefinitionProvider = true;
|
||||||
|
// The server provides Goto Implementation support.
|
||||||
|
bool implementationProvider = true;
|
||||||
// The server provides find references support.
|
// The server provides find references support.
|
||||||
bool referencesProvider = true;
|
bool referencesProvider = true;
|
||||||
// The server provides document highlight support.
|
// The server provides document highlight support.
|
||||||
@ -170,11 +172,12 @@ struct lsServerCapabilities {
|
|||||||
};
|
};
|
||||||
MAKE_REFLECT_STRUCT(lsServerCapabilities, textDocumentSync, hoverProvider,
|
MAKE_REFLECT_STRUCT(lsServerCapabilities, textDocumentSync, hoverProvider,
|
||||||
completionProvider, signatureHelpProvider,
|
completionProvider, signatureHelpProvider,
|
||||||
definitionProvider, typeDefinitionProvider,
|
definitionProvider, implementationProvider,
|
||||||
referencesProvider, documentHighlightProvider,
|
typeDefinitionProvider, referencesProvider,
|
||||||
documentSymbolProvider, workspaceSymbolProvider,
|
documentHighlightProvider, documentSymbolProvider,
|
||||||
codeActionProvider, codeLensProvider,
|
workspaceSymbolProvider, codeActionProvider,
|
||||||
documentFormattingProvider, documentRangeFormattingProvider,
|
codeLensProvider, documentFormattingProvider,
|
||||||
|
documentRangeFormattingProvider,
|
||||||
documentOnTypeFormattingProvider, renameProvider,
|
documentOnTypeFormattingProvider, renameProvider,
|
||||||
documentLinkProvider, executeCommandProvider);
|
documentLinkProvider, executeCommandProvider);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user