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

Generated documentation for single line enum duplicates the same documentation for each enumeration #81578

Closed
dhoverml opened this issue Sep 12, 2023 · 4 comments · Fixed by #81699

Comments

@dhoverml
Copy link

Godot version

v4.2.master.custom_build [98b50eb]

System information

Ubuntu 20.04 LTS

Issue description

Reproducible on 4.2dev3, 4.2dev4, and master.
This is not reproducible on 4.1.1-stable and 4.2dev1 (4.2dev2 crashed).

By single line enum I mean:

## My documentation
enum MyEnum { A, B, C }

The generated documentation looks like this:
enumdocumentationbug

The generated documentation for an enum formatted like this

## My documentation
enum MyEnum {
  A,
  B,
  C
}

looks correct
enumdocumentationbug_good

Steps to reproduce

  1. Attach a script to a node
  2. Add this:
## My documentation
enum MyEnum { A, B, C }
  1. Open the documentation for that node

Minimal reproduction project

N/A

@AThousandShips
Copy link
Member

Cc @anvilfolk

@anvilfolk
Copy link
Contributor

Thanks for the ping! Also @dalexeev who's done a lot of wonderful fixes to the docgen lately, and might have a little more time :) But it's on my radar!

@dalexeev
Copy link
Member

Thanks, I know that this bug exists and I know where it is caused. I wanted to take a look at this along with #78934 when I have time. This is a parser issue, not a DocGen issue.

class_doc_line = MIN(class_doc_line, doc_comment_line - 1);
// Check whether current line has a doc comment
if (has_comment(previous.start_line, true)) {
if constexpr (std::is_same_v<T, ClassNode>) {
member->doc_data = parse_class_doc_comment(previous.start_line, true, true);
} else {
member->doc_data = parse_doc_comment(previous.start_line, true);
}
} else if (has_comment(doc_comment_line, true)) {
if constexpr (std::is_same_v<T, ClassNode>) {
member->doc_data = parse_class_doc_comment(doc_comment_line, true);
} else {
member->doc_data = parse_doc_comment(doc_comment_line);
}
}

@anvilfolk
Copy link
Contributor

Since you already know where/what, I'll stay away from this one! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants