Skip to content

Conversation

@bernardnormier
Copy link
Member

The JS fix for #4546.

Copy link

Copilot AI left a 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 DocSummaryOptions struct to provide flexible control over documentation generation (deprecation tags, remarks, and generated type messages)
  • Renamed writeDocCommentFor to writeDocSummary to 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.
Copy link

Copilot AI Dec 8, 2025

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.

Suggested change
/// Generates and outputs a doc-comment for Slice definition @p p.
/// Generates and outputs a doc-summary for Slice definition @p p.

Copilot uses AI. Check for mistakes.

namespace Slice
{
struct DocSummaryOptions
Copy link
Member Author

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)
Copy link
Member

Choose a reason for hiding this comment

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

🔥

Copy link
Member

@pepone pepone 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, much nicer with the new options.

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.

3 participants