{{ message }}
BridgeJS: Generate Swift doc-comment based on JSDoc#596
Merged
kateinoigakukun merged 3 commits intoFeb 6, 2026
Merged
Conversation
- Added JSDoc parsing (description/@param/@returns) and DocC emission for callable/typed declarations, including classes/interfaces/enums, in `Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/processor.js`, with guards to only read param/return tags on callable nodes. - Added a documented fixture to cover the new behavior and updated the Vitest snapshot (`Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/fixtures/Documentation.d.ts`, `Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/__snapshots__/ts2swift.test.js.snap`). Tests: - `npm test -- -u` (Plugins/BridgeJS/Sources/TS2Swift/JavaScript) Next steps: optionally run `swift test --package-path ./Plugins/BridgeJS` to keep the Swift-side suite green.
…nt skill: new fixtures model lib.dom-style comments (MDN reference blocks, @param text) and updated Vitest snapshots to show how those JSDoc comments render into DocC. Key files: `Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/fixtures/WebIDLDOMDocs.d.ts`, `Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/fixtures/DOMLike.d.ts`, and the refreshed snapshot in `Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/__snapshots__/ts2swift.test.js.snap`. Tests run: `npm test -- -u` (TS2Swift JavaScript).
…ut. Changes: deleted `Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/fixtures/DOMLike.d.ts` and updated `Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/__snapshots__/ts2swift.test.js.snap`. Tests: `npm test -- -u` (TS2Swift JavaScript).
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds JSDoc parsing and Swift DocC comment generation to the TS2Swift processor in BridgeJS. The implementation parses JSDoc comments (description, @param, and @returns tags) from TypeScript declarations and emits corresponding Swift documentation comments with the /// prefix in DocC format.
Changes:
- Added JSDoc parsing logic to extract descriptions, parameter documentation, and return value documentation from TypeScript declarations
- Implemented Swift DocC format emission with proper formatting for parameters (
- Parameters:) and returns (- Returns:) sections - Integrated documentation emission into all declaration types (functions, classes, interfaces, properties, methods, constructors, enums, and exported variables)
Reviewed changes
Copilot reviewed 2 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/fixtures/Documentation.d.ts |
New test fixture with basic JSDoc examples covering functions, interfaces, classes, and various parameter/return documentation patterns |
Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/fixtures/WebIDLDOMDocs.d.ts |
New test fixture with WebIDL-style documentation (DOM API examples) including multi-line descriptions and MDN references |
Plugins/BridgeJS/Sources/TS2Swift/JavaScript/test/__snapshots__/ts2swift.test.js.snap |
Updated snapshots showing generated Swift code with documentation comments for both new test fixtures |
Plugins/BridgeJS/Sources/TS2Swift/JavaScript/src/processor.js |
Core implementation: added emitDocComment, renderJSDocText, splitDocumentationText, hasMeaningfulLine, and buildParameterNameMap methods; integrated documentation emission into all declaration rendering methods; removed old getFullJSDocText method and documentation field from visitPropertyDecl return type |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Sorry, something went wrong.
Hide details
View details
kateinoigakukun
merged commit
bc752fc
into
main
Feb 6, 2026
17 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.
Added JSDoc parsing (description /
@param/@returns) and DocC emission for callable / typed declarations in TS2Swift.