CTAGS-LANG-GDSCRIPT(7)
π ctags-lang-gdscript β no cap, the tea on tagging GDScript π
okay bestie, so this is a page from the Universal Ctags manual set β it's CTAGS-LANG-GDSCRIPT(7), and it's literally just a lil scrapbook of random notes about tagging GDScript source code with Universal Ctags. Not a full spec, not a tutorial, just vibes and field names. π¦
β¨ SYNOPSIS β¨
Like, the whole point in three lines:
ctags ... --languages=+GDScript ...
ctags ... --language-force=GDScript ...
ctags ... --map-GDScript=+.gd ...
That's it. That's the vibe check. π
πΈ DESCRIPTION πΈ
This man page gathers random notes about tagging GDScript source code with Universal Ctags. Random notes!! It's giving "my friend sent me screenshots of the docs instead of a link" energy and honestly? iconic. π
π STORING ANNOTATIONS π
So listen. The Python parser stores decorations in the decorations field, right? Well the GDScript parser is its own main character and stores annotations β the ones starting from @ β into a language specific field called annotations. π«Ά
And here's the tea: even though the examples below enable the field explicitly, it's enabled by default. So you don't even have to ask. She's already there.
"input.gd"
@export
var s = "Hello"
@master
func f(msg):
print(msg)
"output.tags" with --options=NONE --sort=no --fields-GDScript=+{annotations} -o - input.gd
s input.gd /^var s = "Hello"$/;" v annotations:export
f input.gd /^func f(msg):$/;" m annotations:master
see how the annotations just β¨show upβ¨ in their own lil column? obsessed.
π₯ EXTRACTING FUNC π₯
A language object defined with the func keyword gets tagged with the method kind. periodt. π
And just like with annotations, the parser stashes keywords that modify func β stuff like static β into the annotations field too. she's consistent, we love that.
"input.gd"
func f(x):
return x
static func f_s(x):
reutrn x
remote func f_r(x):
return x
yes bestie the reutrn typo is in the original, we're preserving it exactly, no editing the source material, that's the rule π
"output.tags" with --options=NONE --sort=no --fields=+K --fields-GDScript=+{annotations} -o - input.gd
f input.gd /^func f(x):$/;" method
f_s input.gd /^static func f_s(x):$/;" method annotations:static
f_r input.gd /^remote func f_r(x):$/;" method annotations:remote
three funcs, three methods, two with annotation receipts. ate. π₯
π TAGGING IMPLICITLY DEFINED CLASSES π
"A file is a class!" β that's the GDScript motto, fr fr. A class is implicitly defined. Functions, variables, constants, and signals are all parts of that class, even though the class is unnamed by default. she's anonymous, she's mysterious, she's everywhere. π§
Now β if the language specific extra implicitClass is enabled, the parser makes an anonymous tag for the class. And then it fills the scope fields of the tags for all language objects defined in the file with that anonymous tag. chain reaction, gorgeous. π
Let's see an example demonstrating the effect of the extra.
Turning off the extra:
"input.gd"
func f(x):
return x
"output.tags" with --options=NONE --fields=+KZ --extras-GDScript=-{implicitClass} -o - input.gd
f input.gd /^func f(x):$/;" method
just the one tag, no scope, lowkey minimalist.
Turning on the extra:
"input.gd"
func g(x):
return x
"output.tags" with --options=NONE --fields=+KZ --extras-GDScript=+{implicitClass} -o - input.gd
anon_class_84011bee0100 input.gd /^func g(x):$/;" class
g input.gd /^func g(x):$/;" method scope:class:anon_class_84011bee0100
boom π₯ anon class tag materializes, and g gets a scope:class:anon_class_84011bee0100 glow-up. the way that anon tag just appears out of nowhere... main character energy tbh.
π¦ TAGGING THE NAME SPECIFIED WITH CLASS_NAME π¦
class_name is the keyword for giving a name to that implicitly defined class. she finally gets an identity. π
- If
implicitClassis turned off, the parser just extracts the name coming after the keyword with theclasskind. - If
implicitClassis turned on, the parser converts the anonymous tag into a non-anonymous tag with the specified name. And while she's converting, the parser also updates thescopefields of the other tags in the file. teamwork!! π«Ά
Turning off the extra:
"input.gd"
class_name c
func f(x):
return x
"output.tags" with --options=NONE --fields=+KZ --extras-GDScript=-{implicitClass} -o - input.gd
c input.gd /^class_name c$/;" class
f input.gd /^func f(x):$/;" method
Turning on the extra:
"input.gd"
class_name C
func g(x):
return x
"output.tags" with --options=NONE --fields=+KZ --extras-GDScript=+{implicitClass} -o - input.gd
C input.gd /^class_name C$/;" class
g input.gd /^func g(x):$/;" method scope:class:C
yes bestie, the second example really does use capitalCand the first uses lowercasec, and yes the second example really has no blank line betweenclass_name Candfunc g(x):. we copy exactly. character for character. that's the whole rule. π
π FILLING INHERITS FIELD π
The extends keyword specifies the super class for the implicitly defined class. and if the implicitClass extra is turned on, the parser fills the inherits field of the tag for that implicitly defined class with the name of the super class. she's got lineage now. π
"input.gd"
extends B
class_name C
"output.tags" with --options=NONE --fields=+Ki --extras-GDScript=+{implicitClass} -o - input.gd
C input.gd /^class_name C$/;" class inherits:B
and now the plot twist β when --extras=+r is given, the parser extracts the class specified with the extends keyword as a reference tag of class kind with the extended role. cross-reference era. π
"input.gd"
extends B
"output.tags" with --options=NONE --fields=+rEK --extras=+r -o - input.gd
B input.gd /^extends B$/;" class roles:extended extras:reference
roles:extended AND extras:reference?? she's doing both. multitasking queen. π
β SEE ALSO β
that's the whole page bestie, you're officially fluent in GDScript tagging πβ¨
this was CTAGS-LANG-GDSCRIPT(7) from the Universal Ctags manual, version 6.2.1 β k bye, ily, go tag something ππΈπ¦
π¦ where this page comes from
- alpine 3.24: ctags-doc 6.2.1-r0 Β· GPL-2.0-or-later
- fedora 43: ctags 6.2.1-1.fc43 Β· GPL-2.0-or-later
- fedora 44: ctags 6.2.1-3.fc44 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms