-
Notifications
You must be signed in to change notification settings - Fork 602
Update slice2js to generate "The Slice compiler generated ..." #4706
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR updates the slice2js compiler to generate documentation comments with "The Slice compiler generated this..." messages, addressing issue #4546. The changes refactor the documentation generation system to use a more flexible options-based approach and add generated type information to TypeScript output.
Key Changes:
- Introduced
DocSummaryOptionsstruct to provide flexible control over documentation generation (deprecation tags, remarks, and generated type messages) - Renamed
writeDocCommentFortowriteDocSummaryto better reflect its purpose - Updated TypeScript code generation to include "The Slice compiler generated this..." messages for classes, exceptions, structs, enums, and constants
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| cpp/src/slice2js/Gen.h | Adds DocSummaryOptions struct and updates writeDocSummary function signature for configurable documentation generation |
| cpp/src/slice2js/Gen.cpp | Implements documentation generation with generated type messages, refactors writeRemarks to accept StringList, and updates all call sites to use new writeDocSummary API |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| std::string writeConstantValue(const TypePtr&, const SyntaxTreeBasePtr&, const std::string&); | ||
|
|
||
| /// Generates and outputs a doc-comment for Slice definition @p p. |
Copilot
AI
Dec 8, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The documentation comment says "Generates and outputs a doc-comment" but the function is now named writeDocSummary. The comment should say "doc-summary" to match the function name and be consistent with the parameter name DocSummaryOptions.
| /// Generates and outputs a doc-comment for Slice definition @p p. | |
| /// Generates and outputs a doc-summary for Slice definition @p p. |
|
|
||
| namespace Slice | ||
| { | ||
| struct DocSummaryOptions |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use more readable options like in slice2cpp.
|
|
||
| void | ||
| Slice::JsVisitor::writeDocCommentFor(const ContainedPtr& p, bool includeRemarks, bool includeDeprecated) | ||
| Slice::JsVisitor::writeDocSummary(const ContainedPtr& p, const DocSummaryOptions& options) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔥
pepone
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, much nicer with the new options.
The JS fix for #4546.