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

Cleanup Javascript Doc Comment Generation #3086

Merged
merged 2 commits into from
Nov 7, 2024
Merged

Conversation

pepone
Copy link
Member

@pepone pepone commented Nov 6, 2024

Fix #3069

@@ -219,50 +219,6 @@ namespace
return ostr.str();
}

void writeDocSummary(Output& out, const ContainedPtr& p, bool includeDeprecated = true)
Copy link
Member Author

Choose a reason for hiding this comment

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

merged with writeDocCommentFor. Both methods were doing pretty much the same.

Copy link
Member

@InsertCreativityHere InsertCreativityHere left a comment

Choose a reason for hiding this comment

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

Looks good!

{
_out << nl << " * @deprecated";
if (!dc->deprecated().empty())
_out << nl << " * @deprecated ";

Choose a reason for hiding this comment

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

This emits a trailing space when there's no message to write.
We should wait to add the space until we're in one of the blocks.

}
else if (auto deprecated = p->getDeprecationReason())
{
_out << *deprecated << ".";

Choose a reason for hiding this comment

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

I don't think we have any 'official guidance' for how to write your deprecation message.
But if you look at our Slice files, we usually end ours in a period, so this would generate a second period.

I think it's best to just write the message as-is, and if the user needs a period, they can add it in their comment.

}

if (includeDeprecated && dc && dc->isDeprecated())
if (includeDeprecated && (comment->isDeprecated() || p->isDeprecated()))

Choose a reason for hiding this comment

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

I'd add a comment here explaining why we have this javascript specific deprecation logic
(because JS doesn't have a deprecated attribute to map to).

lines.push_back(line);
}
// There's nothing to write for this doc-comment.
return;
Copy link
Member Author

Choose a reason for hiding this comment

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

There is a small issue here, definition marked as deprecated with metadata without a doc comment would be not marked as deprecated in JavaScript because of this early return.

Fixing in a follow up PR.

@pepone pepone merged commit 7552a60 into zeroc-ice:main Nov 7, 2024
19 checks passed
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.

Cleanup Javascript Doc Comment Generation
3 participants