Skip to content

Conversation

@takaokouji
Copy link

@takaokouji takaokouji commented Jan 17, 2026

Summary

This PR implements the new meta-comment directive format for print, puts, and p methods as decided in smalruby/smalruby3-develop#24.

Implementation Details

  • RubyToBlocksConverter: Changed the comment added to looks_say blocks from @smalruby:methodName to @ruby:method:methodName.
  • RubyGenerator:
    • Updated looks_say generator to recognize the new @ruby:method: format.
    • Updated scrub_ to filter out comments starting with @ruby:.
    • Removed all logic and tests related to the legacy @smalruby: format.
  • Tests: Updated converter and generator unit tests to use the new format.

Related Issue

smalruby/smalruby3-develop#24

takaokouji and others added 7 commits January 18, 2026 00:59
- Implemented comment support in RubyToBlocksConverter
- Added handlers for print, puts, and p in LooksConverter
- Added unit tests verifying conversion and comment attachment

Closes scratchfoundation#527

Co-Authored-By: Gemini <noreply@google.com>
- Updated Ruby generator to detect '@smalruby:method' comments on looks_say blocks
- Implemented conversion back to print, puts, or p based on the meta-comment
- Added filtering in the generator to hide @smalruby: meta-comments from output
- Added unit tests for looks_say conversion and meta-comment filtering

Fixes #528
Split long target.createComment() call into multiple lines to comply
with 120 character max-len rule.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Updated _createComment to support minimized parameter (default true) and x/y coordinates
- Updated Looks converter to place meta-comments at (200, 0) and minimize them
- Added unit tests for comment positioning and minimization
- Updated _onBegin and targetCodeToBlocks to align comment Y-coordinate with block Y-coordinate
- Incremented Y-coordinate for sequential statement blocks to prevent overlap
- Relaxed test helpers to allow x/y coordinates in blocks
- Remove manual coordinate calculation in RubyToBlocksConverter to trigger GUI auto-layout.
- Implement post-layout comment repositioning in Blocks container using workspace.cleanUp().
- Update VM state with new block and comment coordinates after layout.
- Update unit tests to omit assertions on block coordinates at the converter level.

Co-Authored-By: Gemini <noreply@google.com>
- Update RubyToBlocksConverter to use @ruby:method: directive
- Update RubyGenerator to recognize @ruby:method: and filter @ruby: prefix
- Remove legacy @smalruby: prefix support and tests as compatibility is not required
- Update unit tests to reflect format changes

🤖 Generated with [Gemini Code](https://gemini.google.com/code)

Co-Authored-By: Gemini <noreply@google.com>
@takaokouji takaokouji changed the title feat: convert print/puts/p to say blocks with comments feat: use new meta-comment format @ruby:method: for print/puts/p Jan 18, 2026
@takaokouji takaokouji merged commit 89096a4 into develop Jan 18, 2026
3 checks passed
@takaokouji takaokouji deleted the feature/issue-527-print-puts-p branch January 18, 2026 04:19
github-actions bot pushed a commit that referenced this pull request Jan 18, 2026
…-527-print-puts-p

feat: use new meta-comment format @ruby:method: for print/puts/p
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.

2 participants