-
-
Notifications
You must be signed in to change notification settings - Fork 21.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GDScript: Add @deprecated
and @experimental
doc comment tags
#78941
GDScript: Add @deprecated
and @experimental
doc comment tags
#78941
Conversation
40feb9e
to
83efe77
Compare
I added the PR to the PRs to review by the team. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems fine to me!
83efe77
to
c1b4505
Compare
I simplified the code a bit. Actually, I'd like to fix the single-line doc comments and some edge cases, but the full syntax already looks fine and further improvements don't related directly to the PR title. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed in the weekly GDScript meeting. Approved! Thanks @dalexeev!
For posterity and documentation purposes, this reintroduces an But with experimental and deprecated flags, that information needs to be stored somewhere, so it makes sense this struct had to be reintroduced :) |
Discussed in the meeting after the approval: what about implementing the @deprecated("Use [that function] instead")
func my_func():
pass It could make it so that it would be usable by other systems than just the documentation? |
I like this a lot - so these flags could actually exist within the GDScript typing datastructures themselves, like |
In theory, we can use doc comments for other systems as well. Note that this uses the BBCode Editor Help markup. ## @deprecated: Use [method function] instead. This is implemented this way for the most part only because the data is stored in The only significant difference between annotations and doc comments is that annotations support constant expressions as arguments. In theory, you might want to do something like const DEPRECATED_TEMPLATE = 'Property "%s" is deprecated. Do not use it.'
@deprecated(DEPRECATED_TEMPLATE % "a")
var a
@deprecated(DEPRECATED_TEMPLATE % "b")
var b but this seems to be a bit of a far-fetched example. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree, so far this is only a documentation concept and it only comes as a boolean flag. If we want to make the system more versatile, it needs to happen in ClassDB as well, not just in GDScript.
Thanks! |
cool |
These attributes are already available in the core documentation, so I think making it available in GDScript documentation is an obvious step. The
@tag
syntax is already used (@tutorial
) and is similar to JavaDoc.Added support for multiline doc comments for enum values:
Regarding inline (single line) doc comments:
[codeblock]
s.Test script 1 - multiline doc comments
Test script 2 - inline doc comments