1CTAGS-LANG-GDSCRIPT(7) Universal Ctags CTAGS-LANG-GDSCRIPT(7)
2
3
4
6 ctags-lang-gdscript - Random notes about tagging GDScript source code
7 with Universal Ctags
8
10 ctags ... --languages=+GDScript ...
11 ctags ... --language-force=GDScript ...
12 ctags ... --map-GDScript=+.gd ...
13
14
16 This man page gathers random notes about tagging GDScript source code
17 with Universal Ctags.
18
20 Like the Python parser storing decorations to decorations field, the
21 GDScript parser stores annotations starting from @ to the language spe‐
22 cific field, annotations. Though the field is enabled explicitly in
23 following examples, the field is enabled by default.
24
25 "input.gd"
26
27 @export
28 var s = "Hello"
29
30 @master
31 func f(msg):
32 print(msg)
33
34 "output.tags" with "--options=NONE --sort=no --fields-GDScript=+{anno‐
35 tations} -o - input.gd"
36
37 s input.gd /^var s = "Hello"$/;" v annotations:export
38 f input.gd /^func f(msg):$/;" m annotations:master
39
41 A language object defined with func keyword is tagged with method kind.
42 Like annotations, the parser stores keywords modifying func like static
43 to the annotations field.
44
45 "input.gd"
46
47 func f(x):
48 return x
49
50 static func f_s(x):
51 reutrn x
52
53 remote func f_r(x):
54 return x
55
56 "output.tags" with "--options=NONE --sort=no --fields=+K
57 --fields-GDScript=+{annotations} -o - input.gd"
58
59 f input.gd /^func f(x):$/;" method
60 f_s input.gd /^static func f_s(x):$/;" method annotations:static
61 f_r input.gd /^remote func f_r(x):$/;" method annotations:remote
62
64 "A file is a class!" in GDScript. A class is implicitly defined. Func‐
65 tions, variables, constants, and signals are parts of the class though
66 the class is unnamed by default.
67
68 If the language specific extra, implicitClass, is enabled, the parser
69 makes a anonymous tag for the class. The parser fills the scope fields
70 of the tags for all language objects defined in the file with the
71 anonymous tag.
72
73 Let's see an example demonstrating the effect of the extra.
74
75 Turning off the extra:
76
77 "input.gd"
78
79 func f(x):
80 return x
81
82 "output.tags" with "--options=NONE --fields=+KZ --extras-GDScript=-{im‐
83 plicitClass} -o - input.gd"
84
85 f input.gd /^func f(x):$/;" method
86
87 Turning on the extra:
88
89 "input.gd"
90
91 func g(x):
92 return x
93
94 "output.tags" with "--options=NONE --fields=+KZ --extras-GDScript=+{im‐
95 plicitClass} -o - input.gd"
96
97 anon_class_84011bee0100 input.gd /^func g(x):$/;" class
98 g input.gd /^func g(x):$/;" method scope:class:anon_class_84011bee0100
99
101 class_name is a keyword for giving a name to the implicitly defined
102 class. If implicitClass is turned off, the parser just extract the
103 name coming after the keyword with class kind. If implicitClass is
104 turned on, the parser converts the anonymous tag to a non-anonymous tag
105 with the specified name. When converting, the parser also updates
106 scope fields of the other tags in the file.
107
108 Turning off the extra:
109
110 "input.gd"
111
112 class_name c
113
114 func f(x):
115 return x
116
117 "output.tags" with "--options=NONE --fields=+KZ --extras-GDScript=-{im‐
118 plicitClass} -o - input.gd"
119
120 c input.gd /^class_name c$/;" class
121 f input.gd /^func f(x):$/;" method
122
123 Turning on the extra:
124
125 "input.gd"
126
127 class_name C
128 func g(x):
129 return x
130
131 "output.tags" with "--options=NONE --fields=+KZ --extras-GDScript=+{im‐
132 plicitClass} -o - input.gd"
133
134 C input.gd /^class_name C$/;" class
135 g input.gd /^func g(x):$/;" method scope:class:C
136
138 extends keyword specifies the super class for the implicitly defined
139 class. If implicitClass extra is turned on, the parser fills inherits
140 field of the tag for the implicitly defined class with the name of su‐
141 per class.
142
143 "input.gd"
144
145 extends B
146 class_name C
147
148 "output.tags" with "--options=NONE --fields=+Ki --extras-GDScript=+{im‐
149 plicitClass} -o - input.gd"
150
151 C input.gd /^class_name C$/;" class inherits:B
152
153 When --extras=+r is given, the parser extracts the class specified with
154 the extends keyword as a referece tag of class kind with extended role.
155
156 "input.gd"
157
158 extends B
159
160 "output.tags" with "--options=NONE --fields=+rEK --extras=+r -o - in‐
161 put.gd"
162
163 B input.gd /^extends B$/;" class roles:extended extras:reference
164
166 ctags(1)
167
168
169
170
1716.0.0 CTAGS-LANG-GDSCRIPT(7)