ctags-lang-gdscript¶
Random notes about tagging GDScript source code with Universal Ctags
Version: | 6.0.0 |
---|---|
Manual group: | Universal Ctags |
Manual section: | 7 |
SYNOPSIS¶
DESCRIPTION¶
This man page gathers random notes about tagging GDScript source code with Universal Ctags.
Storing Annotations¶
Like the Python parser storing decorations to decorations
field,
the GDScript parser stores annotations
starting from @ to the language specific field, annotations
.
Though the field is enabled explicitly in following examples, the
field is enabled by default.
“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”
Extracting func¶
A language object defined with func keyword is tagged with method
kind.
Like annotations, the parser stores keywords modifying func like static to
the annotations
field.
“input.gd”
func f(x):
return x
static func f_s(x):
reutrn x
remote func f_r(x):
return x
“output.tags” with “--options=NONE --sort=no --fields=+K --fields-GDScript=+{annotations} -o - input.gd”
Tagging implicitly defined classes¶
“A file is a class!” in GDScript. A class is implicitly defined. Functions, variables, constants, and signals are parts of the class though the class is unnamed by default.
If the language specific extra, implicitClass
, is enabled, the
parser makes a anonymous tag for the class. The parser fills the scope
fields of the tags for all language objects defined in the file with
the anonymous tag.
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”
Turning on the extra:
“input.gd”
func g(x):
return x
“output.tags” with “--options=NONE --fields=+KZ --extras-GDScript=+{implicitClass} -o - input.gd”
Tagging the name specified with class_name¶
class_name is a keyword for giving a name to the implicitly defined
class. If implicitClass
is turned off, the parser just extract
the name coming after the keyword with class
kind. If
implicitClass
is turned on, the parser converts the anonymous tag
to a non-anonymous tag with the specified name. When converting,
the parser also updates scope fields of the other tags in the file.
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”
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”
Filling inherits
field¶
extends keyword specifies the super class for the implicitly defined class.
If implicitClass extra is turned on, the parser fills inherits
field
of the tag for the implicitly defined class with the name of super class.
“input.gd”
extends B
class_name C
“output.tags” with “--options=NONE --fields=+Ki --extras-GDScript=+{implicitClass} -o - input.gd”
When --extras=+r is given, the parser extracts the class specified with the
extends keyword as a referece tag of class
kind with extended
role.
“input.gd”
extends B
“output.tags” with “--options=NONE --fields=+rEK --extras=+r -o - input.gd”