You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-10 13:00:37 +00:00
Tweak unknown annotation GDScript error for @deprecated/@experimental/@tutorial
These annotations don't exist at a source level, so the error messages point to the documentation comment syntax.
This commit is contained in:
@@ -1624,7 +1624,15 @@ GDScriptParser::AnnotationNode *GDScriptParser::parse_annotation(uint32_t p_vali
|
|||||||
bool valid = true;
|
bool valid = true;
|
||||||
|
|
||||||
if (!valid_annotations.has(annotation->name)) {
|
if (!valid_annotations.has(annotation->name)) {
|
||||||
|
if (annotation->name == "@deprecated") {
|
||||||
|
push_error(R"("@deprecated" annotation does not exist. Use "## @deprecated: Reason here." instead.)");
|
||||||
|
} else if (annotation->name == "@experimental") {
|
||||||
|
push_error(R"("@experimental" annotation does not exist. Use "## @experimental: Reason here." instead.)");
|
||||||
|
} else if (annotation->name == "@tutorial") {
|
||||||
|
push_error(R"("@tutorial" annotation does not exist. Use "## @tutorial(Title): https://example.com" instead.)");
|
||||||
|
} else {
|
||||||
push_error(vformat(R"(Unrecognized annotation: "%s".)", annotation->name));
|
push_error(vformat(R"(Unrecognized annotation: "%s".)", annotation->name));
|
||||||
|
}
|
||||||
valid = false;
|
valid = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
# This annotation should be used within a documentation comment instead:
|
||||||
|
# ## @deprecated: Reason here.
|
||||||
|
|
||||||
|
@deprecated
|
||||||
|
var some_variable = "value"
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
GDTEST_PARSER_ERROR
|
||||||
|
"@deprecated" annotation does not exist. Use "## @deprecated: Reason here." instead.
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
# This annotation should be used within a documentation comment instead:
|
||||||
|
# ## @experimental: Reason here.
|
||||||
|
|
||||||
|
@experimental("This function isn't implemented yet.")
|
||||||
|
func say_hello():
|
||||||
|
pass
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
GDTEST_PARSER_ERROR
|
||||||
|
"@experimental" annotation does not exist. Use "## @experimental: Reason here." instead.
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
# This annotation should be used within a documentation comment instead:
|
||||||
|
# ## @tutorial(Title): https://example.com
|
||||||
|
|
||||||
|
@tutorial("https://example.com")
|
||||||
|
const SOME_CONSTANT = "value"
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
GDTEST_PARSER_ERROR
|
||||||
|
"@tutorial" annotation does not exist. Use "## @tutorial(Title): https://example.com" instead.
|
||||||
Reference in New Issue
Block a user