From d0e7d9b62f0bcc2ba438b12c8bfbf68d82fff0ea Mon Sep 17 00:00:00 2001 From: Thakee Nathees Date: Sun, 29 Nov 2020 08:07:57 +0530 Subject: [PATCH 1/2] Documentation generation for GDScript - ClassDoc added to GDScript and property reflection data were extracted from parse tree - GDScript comments are collected from tokenizer for documentation and applied to the ClassDoc by the GDScript compiler - private docs were excluded (name with underscore prefix and doesn't have any doc comments) - default values (of non exported vars), arguments are extraced from the parser - Integrated with GDScript 2.0 and new enums were added. - merge conflicts fixed --- core/object/script_language.h | 6 + editor/doc_data.cpp | 71 ++++- editor/doc_data.h | 29 ++ editor/editor_file_system.cpp | 9 + editor/editor_help.cpp | 214 +++++++++---- editor/editor_help.h | 1 + editor/plugins/script_editor_plugin.cpp | 12 + editor/plugins/script_editor_plugin.h | 1 + modules/gdnative/nativescript/nativescript.h | 7 + .../pluginscript/pluginscript_script.h | 7 + modules/gdscript/gdscript.cpp | 259 +++++++++++++++- modules/gdscript/gdscript.h | 30 +- modules/gdscript/gdscript_analyzer.cpp | 7 +- modules/gdscript/gdscript_compiler.cpp | 75 ++++- modules/gdscript/gdscript_function.h | 6 + modules/gdscript/gdscript_parser.cpp | 285 ++++++++++++++++++ modules/gdscript/gdscript_parser.h | 38 +++ modules/gdscript/gdscript_tokenizer.cpp | 20 +- modules/gdscript/gdscript_tokenizer.h | 20 ++ modules/mono/csharp_script.h | 8 + modules/visual_script/visual_script.h | 7 + 21 files changed, 1036 insertions(+), 76 deletions(-) diff --git a/core/object/script_language.h b/core/object/script_language.h index 3fd56c2f15..e34e5060a4 100644 --- a/core/object/script_language.h +++ b/core/object/script_language.h @@ -35,6 +35,7 @@ #include "core/io/resource.h" #include "core/templates/map.h" #include "core/templates/pair.h" +#include "editor/doc_data.h" class ScriptLanguage; @@ -145,6 +146,10 @@ public: virtual void set_source_code(const String &p_code) = 0; virtual Error reload(bool p_keep_state = false) = 0; +#ifdef TOOLS_ENABLED + virtual const Vector &get_documentation() const = 0; +#endif // TOOLS_ENABLED + virtual bool has_method(const StringName &p_method) const = 0; virtual MethodInfo get_method_info(const StringName &p_method) const = 0; @@ -305,6 +310,7 @@ public: virtual Ref