mirror of
https://github.com/MaskRay/ccls.git
synced 2024-11-25 09:05:10 +00:00
textDocument/references: add excludeRole
This commit is contained in:
parent
b784685c61
commit
a94788b89f
@ -12,10 +12,12 @@ struct In_TextDocumentReferences : public RequestInMessage {
|
|||||||
MethodType GetMethodType() const override { return kMethodType; }
|
MethodType GetMethodType() const override { return kMethodType; }
|
||||||
struct lsReferenceContext {
|
struct lsReferenceContext {
|
||||||
bool base = true;
|
bool base = true;
|
||||||
|
// Exclude references with any |Role| bits set.
|
||||||
|
Role excludeRole = Role::None;
|
||||||
// Include the declaration of the current symbol.
|
// Include the declaration of the current symbol.
|
||||||
bool includeDeclaration = false;
|
bool includeDeclaration = false;
|
||||||
// Include references with these |Role| bits set.
|
// Include references with all |Role| bits set.
|
||||||
Role role = Role::All;
|
Role role = Role::None;
|
||||||
};
|
};
|
||||||
struct Params {
|
struct Params {
|
||||||
lsTextDocumentIdentifier textDocument;
|
lsTextDocumentIdentifier textDocument;
|
||||||
@ -27,6 +29,7 @@ struct In_TextDocumentReferences : public RequestInMessage {
|
|||||||
};
|
};
|
||||||
MAKE_REFLECT_STRUCT(In_TextDocumentReferences::lsReferenceContext,
|
MAKE_REFLECT_STRUCT(In_TextDocumentReferences::lsReferenceContext,
|
||||||
base,
|
base,
|
||||||
|
excludeRole,
|
||||||
includeDeclaration,
|
includeDeclaration,
|
||||||
role);
|
role);
|
||||||
MAKE_REFLECT_STRUCT(In_TextDocumentReferences::Params,
|
MAKE_REFLECT_STRUCT(In_TextDocumentReferences::Params,
|
||||||
@ -72,7 +75,8 @@ struct Handler_TextDocumentReferences
|
|||||||
sym.usr = stack.back();
|
sym.usr = stack.back();
|
||||||
stack.pop_back();
|
stack.pop_back();
|
||||||
auto fn = [&](Use use, lsSymbolKind parent_kind) {
|
auto fn = [&](Use use, lsSymbolKind parent_kind) {
|
||||||
if (use.role & params.context.role)
|
if (Role(use.role & params.context.role) == params.context.role &&
|
||||||
|
!(use.role & params.context.excludeRole))
|
||||||
if (std::optional<lsLocationEx> ls_loc =
|
if (std::optional<lsLocationEx> ls_loc =
|
||||||
GetLsLocationEx(db, working_files, use, container)) {
|
GetLsLocationEx(db, working_files, use, container)) {
|
||||||
if (container)
|
if (container)
|
||||||
|
Loading…
Reference in New Issue
Block a user