mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[SourceKit] Add option for returning fully qualified types in variable type request
This commit is contained in:
@@ -2591,7 +2591,8 @@ void SwiftLangSupport::collectExpressionTypes(
|
||||
|
||||
void SwiftLangSupport::collectVariableTypes(
|
||||
StringRef FileName, ArrayRef<const char *> Args, Optional<unsigned> Offset,
|
||||
Optional<unsigned> Length, SourceKitCancellationToken CancellationToken,
|
||||
Optional<unsigned> Length, bool FullyQualified,
|
||||
SourceKitCancellationToken CancellationToken,
|
||||
std::function<void(const RequestResult<VariableTypesInFile> &)> Receiver) {
|
||||
std::string Error;
|
||||
SwiftInvocationRef Invok =
|
||||
@@ -2608,13 +2609,16 @@ void SwiftLangSupport::collectVariableTypes(
|
||||
std::function<void(const RequestResult<VariableTypesInFile> &)> Receiver;
|
||||
Optional<unsigned> Offset;
|
||||
Optional<unsigned> Length;
|
||||
bool FullyQualified;
|
||||
|
||||
public:
|
||||
VariableTypeCollectorASTConsumer(
|
||||
std::function<void(const RequestResult<VariableTypesInFile> &)>
|
||||
Receiver,
|
||||
Optional<unsigned> Offset, Optional<unsigned> Length)
|
||||
: Receiver(std::move(Receiver)), Offset(Offset), Length(Length) {}
|
||||
Optional<unsigned> Offset, Optional<unsigned> Length,
|
||||
bool FullyQualified)
|
||||
: Receiver(std::move(Receiver)), Offset(Offset), Length(Length),
|
||||
FullyQualified(FullyQualified) {}
|
||||
|
||||
void handlePrimaryAST(ASTUnitRef AstUnit) override {
|
||||
auto &CompInst = AstUnit->getCompilerInstance();
|
||||
@@ -2638,7 +2642,7 @@ void SwiftLangSupport::collectVariableTypes(
|
||||
llvm::raw_string_ostream OS(TypeBuffer);
|
||||
VariableTypesInFile Result;
|
||||
|
||||
collectVariableType(*SF, Range, Infos, OS);
|
||||
collectVariableType(*SF, Range, FullyQualified, Infos, OS);
|
||||
|
||||
for (auto Info : Infos) {
|
||||
Result.Results.push_back({Info.Offset, Info.Length, Info.TypeOffset, Info.HasExplicitType});
|
||||
@@ -2657,7 +2661,7 @@ void SwiftLangSupport::collectVariableTypes(
|
||||
};
|
||||
|
||||
auto Collector = std::make_shared<VariableTypeCollectorASTConsumer>(
|
||||
Receiver, Offset, Length);
|
||||
Receiver, Offset, Length, FullyQualified);
|
||||
/// FIXME: When request cancellation is implemented and Xcode adopts it,
|
||||
/// don't use 'OncePerASTToken'.
|
||||
static const char OncePerASTToken = 0;
|
||||
|
||||
Reference in New Issue
Block a user