Replies: 2 comments 10 replies
-
We discussed custom annotations at a GDScript team meeting some time ago, here are some thoughts that came up:
|
Beta Was this translation helpful? Give feedback.
-
I see. That means no modifying at AST level. Then is it will be okay to implement some basic annotations for shared usage? There some suggestions i would glad to implement:
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
So i was trying to see if it possible to make custom annotations. I didn't find any documentation about it, so i got into source code too see if it possible to add custom annotations there.
All annotations being registered at gdscript_parser.cpp#L96, its seems that adding one would be easy, if only there was a public API of
GDScriptParser
instance at gdextension. Is it possible? If not, i would be happy to start a new proposal.Also, IMO, annotations should be able to modify output node (pass node as
Node *&p_target
orNode **p_target
at gdscript_parser.h#L1376), or even consume it and split another (like derive macro in rust) (requires to slitly fix all other annotations). In that way it will be possible to make custom complex annotations and more built-in annotationsFor example
decorator
from python (used variadic syntax):that will be converted into
(You can actually already do this by modifying nodes inside actual function node, but its looks akwards)
I would like to open 3 issues (custom annotations through gdextension, modifying / consuming node and
decorator
annotation) and implement it.related:
Beta Was this translation helpful? Give feedback.
All reactions