Skip to content

Commit

Permalink
Handy new --all-targets switch.
Browse files Browse the repository at this point in the history
  • Loading branch information
Andersbakken committed Feb 7, 2015
1 parent 551093a commit dc524c0
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 1 deletion.
12 changes: 12 additions & 0 deletions src/FollowLocationJob.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,18 @@ int FollowLocationJob::execute()
if (symbol.isNull())
return 1;

if (queryFlags() & QueryMessage::AllTargets) {
auto targets = project()->openTargets(location.fileId());
if (targets) {
const Set<String> usrs = targets->value(location);
for (const String &usr : usrs) {
for (const Symbol &s : project()->findByUsr(usr, location.fileId(), Project::ArgDependsOn)) {
write(s.location);
}
}
}
}

const auto target = project()->findTarget(symbol);
if (target.isNull())
return 1;
Expand Down
3 changes: 2 additions & 1 deletion src/QueryMessage.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ class QueryMessage : public RTagsMessage
SynchronousCompletions = 0x04000000,
NoSortReferencesByInput = 0x08000000,
HasLocation = 0x10000000,
WildcardSymbolNames = 0x20000000
WildcardSymbolNames = 0x20000000,
AllTargets = 0x40000000
};

QueryMessage(Type type = Invalid);
Expand Down
4 changes: 4 additions & 0 deletions src/RClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ struct Option opts[] = {
{ RClient::RangeFilter, "range-filter", 0, required_argument, "Filter out results not in the specified range." },
{ RClient::FilterSystemHeaders, "filter-system-headers", 'H', no_argument, "Don't exempt system headers from path filters." },
{ RClient::AllReferences, "all-references", 'e', no_argument, "Include definitions/declarations/constructors/destructors for references. Used for rename symbol." },
{ RClient::AllTargets, "all-targets", 0, no_argument, "Print all targets for -f. Used for debugging." },
{ RClient::ElispList, "elisp-list", 'Y', no_argument, "Output elisp: (list \"one\" \"two\" ...)." },
{ RClient::Diagnostics, "diagnostics", 'G', no_argument, "Receive continual diagnostics from rdm." },
{ RClient::XmlDiagnostics, "xml-diagnostics", 'm', no_argument, "Receive continual XML formatted diagnostics from rdm." },
Expand Down Expand Up @@ -546,6 +547,9 @@ bool RClient::parse(int &argc, char **argv)
case AllReferences:
mQueryFlags |= QueryMessage::AllReferences;
break;
case AllTargets:
mQueryFlags |= QueryMessage::AllTargets;
break;
case MatchCaseInsensitive:
mQueryFlags |= QueryMessage::MatchCaseInsensitive;
break;
Expand Down
1 change: 1 addition & 0 deletions src/RClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ class RClient
None = 0,
AbsolutePath,
AllReferences,
AllTargets,
BuildIndex,
CheckReindex,
Clear,
Expand Down

0 comments on commit dc524c0

Please sign in to comment.