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

Improve JavaScript doc comments for generated code #2604

Merged
merged 2 commits into from
Aug 2, 2024

Conversation

pepone
Copy link
Member

@pepone pepone commented Aug 2, 2024

Fix #2409

}

CommentPtr
Slice::Contained::parseComment(const string& text, bool stripMarkup) const
Copy link
Member Author

Choose a reason for hiding this comment

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

I added this overload to be able to preprocess the coment before parsing. This allow for language specific preprocessing.

@@ -252,7 +284,6 @@ namespace
const OperationPtr& op,
const CommentPtr& doc,
OpDocParamType type,
const StringList& preParams = StringList(),
Copy link
Member Author

Choose a reason for hiding this comment

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

Remove this param, we were always passing an empty list.

}
out << nl << " * @throws " << name << " ";
name = JsGenerator::fixId(name);
out << nl << " * @throws {@link " << name << "} ";
writeDocLines(out, p->second, false);
Copy link
Member Author

Choose a reason for hiding this comment

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

TypeDoc uses this syntax in throws see: https://typedoc.org/tags/throws/

@@ -315,8 +342,6 @@ namespace
const OperationPtr& op,
const CommentPtr& doc,
OpDocParamType type,
bool showExceptions,
Copy link
Member Author

Choose a reason for hiding this comment

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

Removed, we should always write the @throws clauses. We were passing "false" all the time and exceptions were ignored.

Comment on lines +27 to +28
// JavaScript TypeDoc doc processor doesn't accept # at the beginning of a link
// so we need to remove it.
Copy link
Member

Choose a reason for hiding this comment

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

Do these generate valid links still?

Copy link
Member Author

@pepone pepone Aug 2, 2024

Choose a reason for hiding this comment

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

Yes, with Slice and Java doc you can use {@link #foo} to refer to a member of the class. With TypeDoc is just {@link foo}

This was causing warnings mentioned above when parasing

ice/slice/Ice/Metrics.ice

Lines 134 to 136 in 5d4f24b

/// The number of threads which are currently performing other activities. These are all other that are not
/// counted with {@link #inUseForUser} or {@link #inUseForIO}, such as DNS lookups, garbage collection).
int inUseForOther = 0;

@pepone pepone merged commit ed1d370 into zeroc-ice:main Aug 2, 2024
18 checks passed
InsertCreativityHere pushed a commit to InsertCreativityHere/compiler-comparison that referenced this pull request Jan 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Invalid link generated in JavaScript doc comment
3 participants