Skip to content
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 DocGen: Fix and improve appearance of metatypes and values #82067

Merged

Conversation

dalexeev
Copy link
Member

@dalexeev dalexeev commented Sep 21, 2023

  1. Fix metatypes are not taken into account in DocGen.
  2. Fix BBCode markup has effect in EditorHelp.
  3. Fix special characters other than \n not appearing in strings.
  4. Fix unwanted \ns when displaying dictionaries.
  5. Don't display serialized objects.
  6. Add support for displaying typed arrays in constants.
  7. Don't display deeply nested arrays/dictionaries. Perhaps this is not a good heuristic, it’s just that in this implementation you need to specify some kind of limit, and I decided that 100 was too much. In the future, we may improve content clipping when the length exceeding some limit.

Test script

class MyClass: pass
enum MyEnum {A, B, C}

const BROKEN_MARKUP = "test [int] test"
const NESTED_ARRAYS = [1, [2, [3, [4]]]]
const TYPED_ARRAY: Array[int] = [1, 2, 3]

var native_metatype := Node
var class_metatype := MyClass
var enum_metatype := MyEnum
var special_chars := "aaa\nbbb\tccc"

Before

After

@dalexeev dalexeev force-pushed the gds-docgen-fix-metatypes-and-values branch from 9d7e28a to 426ccba Compare September 21, 2023 17:44
@adamscott adamscott removed the bug label Sep 26, 2023
@@ -82,9 +79,18 @@ static void _doctype_from_gdtype(const GDType &p_gdtype, String &r_type, String
r_type = Variant::get_type_name(p_gdtype.builtin_type);
return;
case GDType::NATIVE:
if (p_gdtype.is_meta_type) {
//r_type = GDScriptNativeClass::get_class_static();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Superfluous comment here

Copy link
Member

@adamscott adamscott left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks fine! The code is very clean, thanks Danil!

@akien-mga akien-mga merged commit b9bf46d into godotengine:master Oct 5, 2023
15 checks passed
@akien-mga
Copy link
Member

Thanks!

@dalexeev dalexeev deleted the gds-docgen-fix-metatypes-and-values branch October 5, 2023 08:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants