Skip to content

Commit 29ce0fe

Browse files
committed
[SourceKit] Stub in a new "fully_annotated_decl" field to cursor info
This will eventually replace the existing annoteded_decl for cursor info, and be added to doc info as well. For now put in under a different field name to not break existing clients. For now, just reimplement the existing annotations but put in tag names that are specific to the kind of type/decl. The goal is to fill in a lot more substructure/detail over time. Incidentally flesh out some cursor info tests. rdar://problem/24292226
1 parent 1cd7a86 commit 29ce0fe

File tree

7 files changed

+108
-0
lines changed

7 files changed

+108
-0
lines changed

test/SourceKit/SourceDocInfo/cursor_info.swift

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,12 +87,15 @@ public class SubscriptCursorTest {
8787
// CHECK2-NEXT: Swift{{$}}
8888
// CHECK2-NEXT: SYSTEM
8989
// CHECK2-NEXT: <Declaration>func +(lhs: <Type usr="s:Si">Int</Type>, rhs: <Type usr="s:Si">Int</Type>) -&gt; <Type usr="s:Si">Int</Type></Declaration>
90+
// CHECK2-NEXT: <decl.function.operator.infix>func +(lhs: <ref.struct usr="s:Si">Int</ref.struct>, rhs: <ref.struct usr="s:Si">Int</ref.struct>) -&gt; <ref.struct usr="s:Si">Int</ref.struct></decl.function.operator.infix>
9091

9192
// RUN: %sourcekitd-test -req=cursor -pos=9:12 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | FileCheck -check-prefix=CHECK3 %s
9293
// CHECK3: source.lang.swift.ref.var.local (8:10-8:11)
9394
// CHECK3-NEXT: x{{$}}
9495
// CHECK3-NEXT: s:vF11cursor_info3gooFSiT_L_1xSi{{$}}
9596
// CHECK3-NEXT: Int{{$}}
97+
// CHECK3-NEXT: <Declaration>let x: <Type usr="s:Si">Int</Type></Declaration>
98+
// CHECK3-NEXT: <decl.var.local>let x: <ref.struct usr="s:Si">Int</ref.struct></decl.var.local>
9699

97100
// RUN: %sourcekitd-test -req=cursor -pos=9:18 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | FileCheck -check-prefix=CHECK4 %s
98101
// CHECK4: source.lang.swift.ref.var.global ({{.*}}Foo.framework/Headers/Foo.h:62:12-62:21)
@@ -101,6 +104,7 @@ public class SubscriptCursorTest {
101104
// CHECK4-NEXT: Int32{{$}}
102105
// CHECK4-NEXT: Foo{{$}}
103106
// CHECK4-NEXT: <Declaration>var fooIntVar: <Type usr="s:Vs5Int32">Int32</Type></Declaration>
107+
// CHECK4-NEXT: <decl.var.global>var fooIntVar: <ref.struct usr="s:Vs5Int32">Int32</ref.struct></decl.var.global>
104108
// CHECK4-NEXT: <Variable file="{{[^"]+}}Foo.h" line="{{[0-9]+}}" column="{{[0-9]+}}"><Name>fooIntVar</Name><USR>c:@fooIntVar</USR><Declaration>var fooIntVar: Int32</Declaration><Abstract><Para> Aaa. fooIntVar. Bbb.</Para></Abstract></Variable>
105109

106110
// RUN: %sourcekitd-test -req=cursor -pos=8:7 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | FileCheck -check-prefix=CHECK5 %s
@@ -116,6 +120,7 @@ public class SubscriptCursorTest {
116120
// CHECK6-NEXT: () -> Int
117121
// CHECK6-NEXT: FooSwiftModule
118122
// CHECK6-NEXT: <Declaration>func fooSwiftFunc() -&gt; <Type usr="s:Si">Int</Type></Declaration>
123+
// CHECK6-NEXT: <decl.function.free>func fooSwiftFunc() -&gt; <ref.struct usr="s:Si">Int</ref.struct></decl.function.free>
119124
// CHECK6-NEXT: {{^}}<Function><Name>fooSwiftFunc()</Name><USR>s:F14FooSwiftModule12fooSwiftFuncFT_Si</USR><Declaration>func fooSwiftFunc() -&gt; Int</Declaration><Abstract><Para>This is &apos;fooSwiftFunc&apos; from &apos;FooSwiftModule&apos;.</Para></Abstract></Function>{{$}}
120125

121126
// RUN: %sourcekitd-test -req=cursor -pos=14:10 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | FileCheck -check-prefix=CHECK7 %s
@@ -124,33 +129,41 @@ public class SubscriptCursorTest {
124129
// CHECK7-NEXT: s:V11cursor_info2S1
125130
// CHECK7-NEXT: S1.Type
126131
// CHECK7-NEXT: <Declaration>struct S1</Declaration>
132+
// CHECK7-NEXT: <decl.struct>struct S1</decl.struct>
127133
// CHECK7-NEXT: <Class file="{{[^"]+}}cursor_info.swift" line="13" column="8"><Name>S1</Name><USR>s:V11cursor_info2S1</USR><Declaration>struct S1</Declaration><Abstract><Para>Aaa. S1. Bbb.</Para></Abstract></Class>
128134

129135
// RUN: %sourcekitd-test -req=cursor -pos=19:12 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | FileCheck -check-prefix=CHECK8 %s
130136
// CHECK8: source.lang.swift.ref.function.constructor (18:3-18:15)
131137
// CHECK8-NEXT: init
132138
// CHECK8-NEXT: s:FC11cursor_info2CCcFT1xSi_S0_
133139
// CHECK8-NEXT: CC.Type -> (x: Int) -> CC
140+
// CHECK8-NEXT: <Declaration>convenience init(x: <Type usr="s:Si">Int</Type>)</Declaration>
141+
// CHECK8-NEXT: <decl.function.constructor>convenience init(x: <ref.struct usr="s:Si">Int</ref.struct>)</decl.function.constructor>
134142

135143
// RUN: %sourcekitd-test -req=cursor -pos=23:6 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | FileCheck -check-prefix=CHECK9 %s
136144
// CHECK9: source.lang.swift.decl.var.global (23:5-23:15)
137145
// CHECK9: <Declaration>var testString: <Type usr="s:SS">String</Type></Declaration>
146+
// CHECK9: <decl.var.global>var testString: <ref.struct usr="s:SS">String</ref.struct></decl.var.global>
138147

139148
// RUN: %sourcekitd-test -req=cursor -pos=24:6 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | FileCheck -check-prefix=CHECK10 %s
140149
// CHECK10: source.lang.swift.decl.var.global (24:5-24:18)
141150
// CHECK10: <Declaration>let testLetString: <Type usr="s:SS">String</Type></Declaration>
151+
// CHECK10: <decl.var.global>let testLetString: <ref.struct usr="s:SS">String</ref.struct></decl.var.global>
142152

143153
// RUN: %sourcekitd-test -req=cursor -pos=26:20 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | FileCheck -check-prefix=CHECK11 %s
144154
// CHECK11: source.lang.swift.decl.var.local (26:19-26:23)
145155
// CHECK11: <Declaration>let arg1: <Type usr="s:Si">Int</Type></Declaration>
156+
// CHECK11: <decl.var.local>let arg1: <ref.struct usr="s:Si">Int</ref.struct></decl.var.local>
146157

147158
// RUN: %sourcekitd-test -req=cursor -pos=28:24 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | FileCheck -check-prefix=CHECK12 %s
148159
// CHECK12: source.lang.swift.decl.var.local (28:23-28:27)
149160
// CHECK12: <Declaration>var arg1: <Type usr="s:Si">Int</Type></Declaration>
161+
// CHECK12: <decl.var.local>var arg1: <ref.struct usr="s:Si">Int</ref.struct></decl.var.local>
150162

151163
// RUN: %sourcekitd-test -req=cursor -pos=31:7 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | FileCheck -check-prefix=CHECK13 %s
152164
// CHECK13: source.lang.swift.decl.function.free (31:6-31:37)
153165
// CHECK13: <Declaration>func testDefaultParam(arg1: <Type usr="s:Si">Int</Type> = default)</Declaration>
166+
// CHECK13: <decl.function.free>func testDefaultParam(arg1: <ref.struct usr="s:Si">Int</ref.struct> = default)</decl.function.free>
154167

155168
// RUN: %sourcekitd-test -req=cursor -pos=34:4 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | FileCheck -check-prefix=CHECK14 %s
156169
// CHECK14: source.lang.swift.ref.function.free ({{.*}}Foo.framework/Frameworks/FooSub.framework/Headers/FooSub.h:4:5-4:16)
@@ -162,6 +175,7 @@ public class SubscriptCursorTest {
162175
// CHECK15: source.lang.swift.decl.function.free (38:6-38:40)
163176
// CHECK15: myFunc
164177
// CHECK15: <Declaration>func myFunc(arg1: <Type usr="s:SS">String</Type>, options: <Type usr="s:Si">Int</Type>)</Declaration>
178+
// CHECK15: <decl.function.free>func myFunc(arg1: <ref.struct usr="s:SS">String</ref.struct>, options: <ref.struct usr="s:Si">Int</ref.struct>)</decl.function.free>
165179
// CHECK15: RELATED BEGIN
166180
// CHECK15-NEXT: <RelatedName usr="s:F11cursor_info6myFuncFSST_">myFunc(_:)</RelatedName>
167181
// CHECK15-NEXT: RELATED END
@@ -170,6 +184,8 @@ public class SubscriptCursorTest {
170184
// CHECK16: source.lang.swift.ref.class ({{.*}}Foo.framework/Headers/Foo.h:157:12-157:27)
171185
// CHECK16-NEXT: FooClassDerived
172186
// CHECK16-NEXT: c:objc(cs)FooClassDerived
187+
// CHECK16: <Declaration>class FooClassDerived : <Type usr="c:objc(cs)FooClassBase">FooClassBase</Type>, <Type usr="c:objc(pl)FooProtocolDerived">FooProtocolDerived</Type></Declaration>
188+
// CHECK16-NEXT: <decl.class>class FooClassDerived : <ref.class usr="c:objc(cs)FooClassBase">FooClassBase</ref.class>, <ref.protocol usr="c:objc(pl)FooProtocolDerived">FooProtocolDerived</ref.protocol></decl.class>
173189

174190
// RUN: %sourcekitd-test -req=cursor -pos=1:10 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | FileCheck -check-prefix=CHECK17 %s
175191
// CHECK17: source.lang.swift.ref.module ()
@@ -178,6 +194,7 @@ public class SubscriptCursorTest {
178194
// RUN: %sourcekitd-test -req=cursor -pos=44:10 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | FileCheck -check-prefix=CHECK18 %s
179195
// CHECK18: source.lang.swift.ref.typealias (43:11-43:16)
180196
// CHECK18: <Declaration>typealias MyInt = <Type usr="s:Si">Int</Type></Declaration>
197+
// CHECK18: <decl.typealias>typealias MyInt = <ref.struct usr="s:Si">Int</ref.struct></decl.typealias>
181198

182199
// RUN: %sourcekitd-test -req=cursor -pos=46:10 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | FileCheck -check-prefix=CHECK19 %s
183200
// CHECK19: source.lang.swift.ref.module ()
@@ -193,22 +210,29 @@ public class SubscriptCursorTest {
193210

194211
// RUN: %sourcekitd-test -req=cursor -pos=55:15 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | FileCheck -check-prefix=CHECK22 %s
195212
// CHECK22: <Declaration>func availabilityIntroduced()</Declaration>
213+
// CHECK22: <decl.function.method.instance>func availabilityIntroduced()</decl.function.method.instance>
196214

197215
// RUN: %sourcekitd-test -req=cursor -pos=56:15 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | FileCheck -check-prefix=CHECK23 %s
198216
// CHECK23-NOT: <Declaration>func swiftUnavailable()</Declaration>
217+
// CHECK23-NOT: <decl.function.method.instance>func swiftUnavailable()</decl.function.method.instance>
199218

200219
// RUN: %sourcekitd-test -req=cursor -pos=57:15 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | FileCheck -check-prefix=CHECK24 %s
201220
// CHECK24-NOT: <Declaration>func unavailable()</Declaration>
221+
// CHECK24-NOT: <decl.function.method.instance>func unavailable()</decl.function.method.instance>
202222

203223
// RUN: %sourcekitd-test -req=cursor -pos=58:15 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | FileCheck -check-prefix=CHECK25 %s
204224
// CHECK25: <Declaration>func availabilityIntroducedMsg()</Declaration>
225+
// CHECK25: <decl.function.method.instance>func availabilityIntroducedMsg()</decl.function.method.instance>
205226

206227
// RUN: %sourcekitd-test -req=cursor -pos=59:15 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | FileCheck -check-prefix=CHECK26 %s
207228
// CHECK26-NOT: <Declaration>func availabilityDeprecated()</Declaration>
229+
// CHECK26-NOT: <decl.function.method.instance>func availabilityDeprecated()</decl.function.method.instance>
208230

209231
// RUN: %sourcekitd-test -req=cursor -pos=69:14 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | FileCheck -check-prefix=CHECK27 %s
210232
// CHECK27: <Declaration>public subscript (i: <Type usr="s:Si">Int</Type>) -&gt; <Type usr="s:Si">Int</Type> { get }</Declaration>
233+
// CHECK27: <decl.function.subscript>public subscript (i: <ref.struct usr="s:Si">Int</ref.struct>) -&gt; <ref.struct usr="s:Si">Int</ref.struct> { get }</decl.function.subscript>
211234

212235
// RUN: %sourcekitd-test -req=cursor -pos=69:19 %s -- -F %S/../Inputs/libIDE-mock-sdk -I %t.tmp %mcp_opt %s | FileCheck -check-prefix=CHECK28 %s
213236
// CHECK28: <Declaration>public subscript (i: <Type usr="s:Si">Int</Type>) -&gt; <Type usr="s:Si">Int</Type> { get }</Declaration>
237+
// CHECK28: <decl.function.subscript>public subscript (i: <ref.struct usr="s:Si">Int</ref.struct>) -&gt; <ref.struct usr="s:Si">Int</ref.struct> { get }</decl.function.subscript>
214238

tools/SourceKit/include/SourceKit/Core/LangSupport.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,9 @@ struct CursorInfo {
277277
StringRef GroupName;
278278
/// Annotated XML pretty printed declaration.
279279
StringRef AnnotatedDeclaration;
280+
/// Fully annotated XML pretty printed declaration.
281+
/// FIXME: this should eventually replace \c AnnotatedDeclaration.
282+
StringRef FullyAnnotatedDeclaration;
280283
/// Non-empty if the symbol was imported from a clang module.
281284
StringRef ModuleName;
282285
/// Non-empty if a generated interface editor document has previously been

tools/SourceKit/lib/SwiftLang/SwiftSourceDocInfo.cpp

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,49 @@ class AnnotatedDeclarationPrinter : public XMLEscapingPrinter {
5555
}
5656
};
5757

58+
static StringRef getTagForDecl(const Decl *D, bool isRef) {
59+
auto UID = SwiftLangSupport::getUIDForDecl(D, isRef);
60+
static const char *prefix = "source.lang.swift.";
61+
assert(UID.getName().startswith(prefix));
62+
return UID.getName().drop_front(strlen(prefix));
63+
}
64+
65+
/// An ASTPrinter for annotating declarations with XML tags that describe the
66+
/// key substructure of the declaration for CursorInfo/DocInfo.
67+
///
68+
/// Prints declarations with decl- and type-specific tags derived from the
69+
/// UIDs used for decl/refs. For example,
70+
/// <decl.function.free>func foo(x: <ref.struct usr="Si">Int</...>)</...>
71+
class FullyAnnotatedDeclarationPrinter final : public XMLEscapingPrinter {
72+
public:
73+
FullyAnnotatedDeclarationPrinter(raw_ostream &OS) : XMLEscapingPrinter(OS) {}
74+
75+
private:
76+
77+
// MARK: The ASTPrinter callback interface.
78+
79+
void printDeclPre(const Decl *D) override {
80+
openTag(getTagForDecl(D, /*isRef=*/false));
81+
}
82+
void printDeclPost(const Decl *D) override {
83+
closeTag(getTagForDecl(D, /*isRef=*/false));
84+
}
85+
86+
void printTypeRef(const TypeDecl *TD, Identifier name) override {
87+
auto tag = getTagForDecl(TD, /*isRef=*/true);
88+
OS << "<" << tag << " usr=\"";
89+
SwiftLangSupport::printUSR(TD, OS);
90+
OS << "\">";
91+
XMLEscapingPrinter::printTypeRef(TD, name);
92+
closeTag(tag);
93+
}
94+
95+
// MARK: Convenience functions for printing.
96+
97+
void openTag(StringRef tag) { OS << "<" << tag << ">"; }
98+
void closeTag(StringRef tag) { OS << "</" << tag << ">"; }
99+
};
100+
58101
static Type findBaseTypeForReplacingArchetype(const ValueDecl *VD, const Type Ty) {
59102
if (Ty.isNull())
60103
return Type();
@@ -98,6 +141,22 @@ static void printAnnotatedDeclaration(const ValueDecl *VD, const Type Ty,
98141
OS<<"</Declaration>";
99142
}
100143

144+
static void printFullyAnnotatedDeclaration(const ValueDecl *VD, const Type Ty,
145+
const Type BaseTy, raw_ostream &OS) {
146+
FullyAnnotatedDeclarationPrinter Printer(OS);
147+
PrintOptions PO = PrintOptions::printQuickHelpDeclaration();
148+
if (BaseTy)
149+
PO.setArchetypeTransformForQuickHelp(BaseTy, VD->getDeclContext());
150+
151+
// If it's implicit, try to find an overridden ValueDecl that's not implicit.
152+
// This will ensure we can properly annotate TypeRepr with a usr
153+
// in AnnotatedDeclarationPrinter.
154+
while (VD->isImplicit() && VD->getOverriddenDecl())
155+
VD = VD->getOverriddenDecl();
156+
157+
VD->print(Printer, PO);
158+
}
159+
101160
template <typename FnTy>
102161
void walkRelatedDecls(const ValueDecl *VD, const FnTy &Fn) {
103162
llvm::SmallDenseMap<DeclName, unsigned, 16> NamesSeen;
@@ -299,6 +358,13 @@ static bool passCursorInfoForDecl(const ValueDecl *VD,
299358
}
300359
unsigned DeclEnd = SS.size();
301360

361+
unsigned FullDeclBegin = SS.size();
362+
{
363+
llvm::raw_svector_ostream OS(SS);
364+
printFullyAnnotatedDeclaration(VD, Ty, BaseType, OS);
365+
}
366+
unsigned FullDeclEnd = SS.size();
367+
302368
unsigned GroupBegin = SS.size();
303369
{
304370
llvm::raw_svector_ostream OS(SS);
@@ -387,6 +453,8 @@ static bool passCursorInfoForDecl(const ValueDecl *VD,
387453
DocCommentEnd-DocCommentBegin);
388454
StringRef AnnotatedDecl = StringRef(SS.begin()+DeclBegin,
389455
DeclEnd-DeclBegin);
456+
StringRef FullyAnnotatedDecl =
457+
StringRef(SS.begin() + FullDeclBegin, FullDeclEnd - FullDeclBegin);
390458
StringRef GroupName = StringRef(SS.begin() + GroupBegin, GroupEnd - GroupBegin);
391459

392460
llvm::Optional<std::pair<unsigned, unsigned>> DeclarationLoc;
@@ -423,6 +491,7 @@ static bool passCursorInfoForDecl(const ValueDecl *VD,
423491
Info.TypeName = TypeName;
424492
Info.DocComment = DocComment;
425493
Info.AnnotatedDeclaration = AnnotatedDecl;
494+
Info.FullyAnnotatedDeclaration = FullyAnnotatedDecl;
426495
Info.ModuleName = ModuleName;
427496
Info.ModuleInterfaceName = ModuleInterfaceName;
428497
Info.DeclarationLoc = DeclarationLoc;

tools/SourceKit/tools/sourcekitd-test/sourcekitd-test.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ static sourcekitd_uid_t KeyTypename;
8585
static sourcekitd_uid_t KeyOverrides;
8686
static sourcekitd_uid_t KeyRelatedDecls;
8787
static sourcekitd_uid_t KeyAnnotatedDecl;
88+
static sourcekitd_uid_t KeyFullyAnnotatedDecl;
8889
static sourcekitd_uid_t KeyDocFullAsXML;
8990
static sourcekitd_uid_t KeyResults;
9091
static sourcekitd_uid_t KeySyntaxMap;
@@ -171,6 +172,8 @@ static int skt_main(int argc, const char **argv) {
171172
KeyOverrides = sourcekitd_uid_get_from_cstr("key.overrides");
172173
KeyRelatedDecls = sourcekitd_uid_get_from_cstr("key.related_decls");
173174
KeyAnnotatedDecl = sourcekitd_uid_get_from_cstr("key.annotated_decl");
175+
KeyFullyAnnotatedDecl =
176+
sourcekitd_uid_get_from_cstr("key.fully_annotated_decl");
174177
KeyDocFullAsXML = sourcekitd_uid_get_from_cstr("key.doc.full_as_xml");
175178
KeyResults = sourcekitd_uid_get_from_cstr("key.results");
176179
KeySyntaxMap = sourcekitd_uid_get_from_cstr("key.syntaxmap");
@@ -879,6 +882,8 @@ static void printCursorInfo(sourcekitd_variant_t Info, StringRef FilenameIn,
879882
bool IsSystem = sourcekitd_variant_dictionary_get_bool(Info, KeyIsSystem);
880883
const char *AnnotDecl = sourcekitd_variant_dictionary_get_string(Info,
881884
KeyAnnotatedDecl);
885+
const char *FullAnnotDecl =
886+
sourcekitd_variant_dictionary_get_string(Info, KeyFullyAnnotatedDecl);
882887
const char *DocFullAsXML =
883888
sourcekitd_variant_dictionary_get_string(Info, KeyDocFullAsXML);
884889
sourcekitd_variant_t OffsetObj =
@@ -937,6 +942,8 @@ static void printCursorInfo(sourcekitd_variant_t Info, StringRef FilenameIn,
937942
OS << "SYSTEM\n";
938943
if (AnnotDecl)
939944
OS << AnnotDecl << '\n';
945+
if (FullAnnotDecl)
946+
OS << FullAnnotDecl << '\n';
940947
if (DocFullAsXML)
941948
OS << DocFullAsXML << '\n';
942949
OS << "OVERRIDES BEGIN\n";

tools/SourceKit/tools/sourcekitd/lib/API/DictionaryKeys.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ extern SourceKit::UIdent KeyDocFullAsXML;
5656
extern SourceKit::UIdent KeyGenericParams;
5757
extern SourceKit::UIdent KeyGenericRequirements;
5858
extern SourceKit::UIdent KeyAnnotatedDecl;
59+
extern SourceKit::UIdent KeyFullyAnnotatedDecl;
5960
extern SourceKit::UIdent KeyRelatedDecls;
6061
extern SourceKit::UIdent KeyContext;
6162
extern SourceKit::UIdent KeyModuleImportDepth;

tools/SourceKit/tools/sourcekitd/lib/API/Requests.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1123,6 +1123,8 @@ static void reportCursorInfo(StringRef Filename,
11231123
Elem.set(KeyDocFullAsXML, Info.DocComment);
11241124
if (!Info.AnnotatedDeclaration.empty())
11251125
Elem.set(KeyAnnotatedDecl, Info.AnnotatedDeclaration);
1126+
if (!Info.FullyAnnotatedDeclaration.empty())
1127+
Elem.set(KeyFullyAnnotatedDecl, Info.FullyAnnotatedDeclaration);
11261128
if (!Info.ModuleName.empty())
11271129
Elem.set(KeyModuleName, Info.ModuleName);
11281130
if (!Info.GroupName.empty())

tools/SourceKit/tools/sourcekitd/lib/API/sourcekitdAPI-Common.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ UIdent sourcekitd::KeyDocFullAsXML("key.doc.full_as_xml");
6969
UIdent sourcekitd::KeyGenericParams("key.generic_params");
7070
UIdent sourcekitd::KeyGenericRequirements("key.generic_requirements");
7171
UIdent sourcekitd::KeyAnnotatedDecl("key.annotated_decl");
72+
UIdent sourcekitd::KeyFullyAnnotatedDecl("key.fully_annotated_decl");
7273
UIdent sourcekitd::KeyRelatedDecls("key.related_decls");
7374
UIdent sourcekitd::KeyContext("key.context");
7475
UIdent sourcekitd::KeyModuleImportDepth("key.moduleimportdepth");
@@ -158,6 +159,7 @@ static UIdent *OrderedKeys[] = {
158159
&KeyRuntimeName,
159160
&KeySelectorName,
160161
&KeyAnnotatedDecl,
162+
&KeyFullyAnnotatedDecl,
161163
&KeyDocBrief,
162164
&KeyContext,
163165
&KeyModuleImportDepth,

0 commit comments

Comments
 (0)