Skip to content

Commit d734714

Browse files
committed
Merge pull request godotengine#78990 from RedMser/class-reference-keywords
Add search keywords to the class reference
2 parents dd33eac + 771d541 commit d734714

18 files changed

Lines changed: 175 additions & 41 deletions

core/doc_data.h

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ class DocData {
117117
bool is_experimental = false;
118118
Vector<ArgumentDoc> arguments;
119119
Vector<int> errors_returned;
120+
String keywords;
120121
bool operator<(const MethodDoc &p_method) const {
121122
if (name == p_method.name) {
122123
// Must be an operator or a constructor since there is no other overloading
@@ -195,6 +196,10 @@ class DocData {
195196
doc.errors_returned.push_back(errors_returned[i]);
196197
}
197198

199+
if (p_dict.has("keywords")) {
200+
doc.keywords = p_dict["keywords"];
201+
}
202+
198203
return doc;
199204
}
200205
static Dictionary to_dict(const MethodDoc &p_doc) {
@@ -225,6 +230,10 @@ class DocData {
225230

226231
dict["is_experimental"] = p_doc.is_experimental;
227232

233+
if (!p_doc.keywords.is_empty()) {
234+
dict["keywords"] = p_doc.keywords;
235+
}
236+
228237
if (!p_doc.arguments.is_empty()) {
229238
Array arguments;
230239
for (int i = 0; i < p_doc.arguments.size(); i++) {
@@ -254,6 +263,7 @@ class DocData {
254263
String description;
255264
bool is_deprecated = false;
256265
bool is_experimental = false;
266+
String keywords;
257267
bool operator<(const ConstantDoc &p_const) const {
258268
return name < p_const.name;
259269
}
@@ -291,6 +301,10 @@ class DocData {
291301
doc.is_experimental = p_dict["is_experimental"];
292302
}
293303

304+
if (p_dict.has("keywords")) {
305+
doc.keywords = p_dict["keywords"];
306+
}
307+
294308
return doc;
295309
}
296310
static Dictionary to_dict(const ConstantDoc &p_doc) {
@@ -319,6 +333,10 @@ class DocData {
319333

320334
dict["is_experimental"] = p_doc.is_experimental;
321335

336+
if (!p_doc.keywords.is_empty()) {
337+
dict["keywords"] = p_doc.keywords;
338+
}
339+
322340
return dict;
323341
}
324342
};
@@ -335,6 +353,7 @@ class DocData {
335353
String overrides;
336354
bool is_deprecated = false;
337355
bool is_experimental = false;
356+
String keywords;
338357
bool operator<(const PropertyDoc &p_prop) const {
339358
return name.naturalcasecmp_to(p_prop.name) < 0;
340359
}
@@ -388,6 +407,10 @@ class DocData {
388407
doc.is_experimental = p_dict["is_experimental"];
389408
}
390409

410+
if (p_dict.has("keywords")) {
411+
doc.keywords = p_dict["keywords"];
412+
}
413+
391414
return doc;
392415
}
393416
static Dictionary to_dict(const PropertyDoc &p_doc) {
@@ -432,6 +455,10 @@ class DocData {
432455

433456
dict["is_experimental"] = p_doc.is_experimental;
434457

458+
if (!p_doc.keywords.is_empty()) {
459+
dict["keywords"] = p_doc.keywords;
460+
}
461+
435462
return dict;
436463
}
437464
};
@@ -442,6 +469,7 @@ class DocData {
442469
String data_type;
443470
String description;
444471
String default_value;
472+
String keywords;
445473
bool operator<(const ThemeItemDoc &p_theme_item) const {
446474
// First sort by the data type, then by name.
447475
if (data_type == p_theme_item.data_type) {
@@ -472,6 +500,10 @@ class DocData {
472500
doc.default_value = p_dict["default_value"];
473501
}
474502

503+
if (p_dict.has("keywords")) {
504+
doc.keywords = p_dict["keywords"];
505+
}
506+
475507
return doc;
476508
}
477509
static Dictionary to_dict(const ThemeItemDoc &p_doc) {
@@ -497,6 +529,10 @@ class DocData {
497529
dict["default_value"] = p_doc.default_value;
498530
}
499531

532+
if (!p_doc.keywords.is_empty()) {
533+
dict["keywords"] = p_doc.keywords;
534+
}
535+
500536
return dict;
501537
}
502538
};
@@ -573,6 +609,7 @@ class DocData {
573609
String inherits;
574610
String brief_description;
575611
String description;
612+
String keywords;
576613
Vector<TutorialDoc> tutorials;
577614
Vector<MethodDoc> constructors;
578615
Vector<MethodDoc> methods;
@@ -609,6 +646,10 @@ class DocData {
609646
doc.description = p_dict["description"];
610647
}
611648

649+
if (p_dict.has("keywords")) {
650+
doc.keywords = p_dict["keywords"];
651+
}
652+
612653
Array tutorials;
613654
if (p_dict.has("tutorials")) {
614655
tutorials = p_dict["tutorials"];
@@ -816,6 +857,10 @@ class DocData {
816857
dict["script_path"] = p_doc.script_path;
817858
}
818859

860+
if (!p_doc.keywords.is_empty()) {
861+
dict["keywords"] = p_doc.keywords;
862+
}
863+
819864
return dict;
820865
}
821866
};

doc/class.xsd

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@
101101
<xs:attribute type="xs:string" name="qualifiers" use="optional" />
102102
<xs:attribute type="xs:boolean" name="is_deprecated" use="optional" />
103103
<xs:attribute type="xs:boolean" name="is_experimental" use="optional" />
104+
<xs:attribute type="xs:string" name="keywords" use="optional" />
104105
</xs:complexType>
105106
</xs:element>
106107
</xs:sequence>
@@ -123,6 +124,7 @@
123124
<xs:attribute type="xs:string" name="default" use="optional" />
124125
<xs:attribute type="xs:boolean" name="is_deprecated" use="optional" />
125126
<xs:attribute type="xs:boolean" name="is_experimental" use="optional" />
127+
<xs:attribute type="xs:string" name="keywords" use="optional" />
126128
</xs:extension>
127129
</xs:simpleContent>
128130
</xs:complexType>
@@ -144,6 +146,7 @@
144146
<xs:attribute type="xs:byte" name="index" />
145147
<xs:attribute type="xs:string" name="name" />
146148
<xs:attribute type="xs:string" name="type" />
149+
<xs:attribute type="xs:string" name="keywords" use="optional" />
147150
</xs:complexType>
148151
</xs:element>
149152
<xs:element type="xs:string" name="description" />
@@ -169,6 +172,7 @@
169172
<xs:attribute type="xs:boolean" name="is_bitfield" use="optional" />
170173
<xs:attribute type="xs:boolean" name="is_deprecated" use="optional" />
171174
<xs:attribute type="xs:boolean" name="is_experimental" use="optional" />
175+
<xs:attribute type="xs:string" name="keywords" use="optional" />
172176
</xs:extension>
173177
</xs:simpleContent>
174178
</xs:complexType>
@@ -209,6 +213,7 @@
209213
</xs:sequence>
210214
<xs:attribute type="xs:string" name="name" use="optional" />
211215
<xs:attribute type="xs:string" name="qualifiers" use="optional" />
216+
<xs:attribute type="xs:string" name="keywords" use="optional" />
212217
</xs:complexType>
213218
</xs:element>
214219
</xs:sequence>
@@ -225,6 +230,7 @@
225230
<xs:attribute type="xs:string" name="data_type" />
226231
<xs:attribute type="xs:string" name="type" />
227232
<xs:attribute type="xs:string" name="default" use="optional" />
233+
<xs:attribute type="xs:string" name="keywords" use="optional" />
228234
</xs:extension>
229235
</xs:simpleContent>
230236
</xs:complexType>
@@ -275,6 +281,7 @@
275281
<xs:attribute type="xs:string" name="inherits" />
276282
<xs:attribute type="xs:boolean" name="is_deprecated" use="optional" />
277283
<xs:attribute type="xs:boolean" name="is_experimental" use="optional" />
284+
<xs:attribute type="xs:string" name="keywords" use="optional" />
278285
</xs:complexType>
279286
</xs:element>
280287
</xs:schema>

doc/classes/@GlobalScope.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1080,7 +1080,7 @@
10801080
[b]Note:[/b] This function is called automatically when the project is run. If you need to fix the seed to have consistent, reproducible results, use [method seed] to initialize the random number generator.
10811081
</description>
10821082
</method>
1083-
<method name="remap">
1083+
<method name="remap" keywords="range, lerp">
10841084
<return type="float" />
10851085
<param index="0" name="value" type="float" />
10861086
<param index="1" name="istart" type="float" />

doc/classes/Area2D.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="UTF-8" ?>
2-
<class name="Area2D" inherits="CollisionObject2D" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
2+
<class name="Area2D" inherits="CollisionObject2D" keywords="trigger" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
33
<brief_description>
44
A region of 2D space that detects other [CollisionObject2D]s entering or exiting it.
55
</brief_description>

doc/classes/Area3D.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="UTF-8" ?>
2-
<class name="Area3D" inherits="CollisionObject3D" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
2+
<class name="Area3D" inherits="CollisionObject3D" keywords="trigger" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
33
<brief_description>
44
A region of 3D space that detects other [CollisionObject3D]s entering or exiting it.
55
</brief_description>

doc/classes/Array.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@
332332
Returns the script associated with a typed array tied to a class name.
333333
</description>
334334
</method>
335-
<method name="has" qualifiers="const">
335+
<method name="has" qualifiers="const" keywords="includes, contains">
336336
<return type="bool" />
337337
<param index="0" name="value" type="Variant" />
338338
<description>

doc/classes/DirAccess.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="UTF-8" ?>
2-
<class name="DirAccess" inherits="RefCounted" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
2+
<class name="DirAccess" inherits="RefCounted" keywords="directory, path, folder" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
33
<brief_description>
44
Provides methods for managing directories and their content.
55
</brief_description>

doc/classes/InputEventMouseButton.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="UTF-8" ?>
2-
<class name="InputEventMouseButton" inherits="InputEventMouse" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
2+
<class name="InputEventMouseButton" inherits="InputEventMouse" keywords="click, press" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
33
<brief_description>
44
Represents a mouse button being pressed or released.
55
</brief_description>

doc/classes/Node.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -722,7 +722,7 @@
722722
Calls [method Object.notification] with [param what] on this node and all of its children, recursively.
723723
</description>
724724
</method>
725-
<method name="queue_free">
725+
<method name="queue_free" keywords="delete, remove, kill, die">
726726
<return type="void" />
727727
<description>
728728
Queues this node to be deleted at the end of the current frame. When deleted, all of its children are deleted as well, and all references to the node and its children become invalid.

doc/classes/Object.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -623,7 +623,7 @@
623623
[b]Note:[/b] In C#, [param signal] must be in snake_case when referring to built-in Godot signals. Prefer using the names exposed in the [code]SignalName[/code] class to avoid allocating a new [StringName] on each call.
624624
</description>
625625
</method>
626-
<method name="free">
626+
<method name="free" keywords="delete, remove, kill, die">
627627
<return type="void" />
628628
<description>
629629
Deletes the object from memory. Pre-existing references to the object become invalid, and any attempt to access them will result in a run-time error. Checking the references with [method @GlobalScope.is_instance_valid] will return [code]false[/code].

0 commit comments

Comments
 (0)