Skip to content

feat: add class insertion button to Ruby tab More menu#292

Merged
takaokouji merged 2 commits intodevelopfrom
feature/insert-class-button
Mar 13, 2026
Merged

feat: add class insertion button to Ruby tab More menu#292
takaokouji merged 2 commits intodevelopfrom
feature/insert-class-button

Conversation

@takaokouji
Copy link

Summary

Ruby タブの More メニュー(⋯)に「クラスを挿入」アイテムを追加。ワンクリックで現在のコードを class で包む。

  • エディタのコードに class が既にあれば何もしない
  • class がなければ RubyGenerator._wrapWithClass(forFileOutput=true) と同等のロジックで:
    • スプライト名から className を決定
    • デフォルトから変化した属性の set_xxx を追加
    • class body に書けないトップレベルコードをコメント化
    • 既存コードをインデントして class body に挿入
  • Monaco executeEdits を使用し Undo 対応

Implementation Steps

  • Phase 1: class 挿入ロジック (insert-class.js) + 18 unit tests
  • Phase 2: UI — More メニューにアイテム追加 + ruby-tab ハンドラ
  • Phase 3: ロケールファイル更新 (ja.js, ja-Hira.js)
  • Phase Final: Integration tests

Test Plan

  • 18 unit tests for wrapCurrentCodeWithClass
  • Manual verification via Playwright

Closes #291

takaokouji and others added 2 commits March 13, 2026 14:09
Add a standalone utility that wraps existing Ruby code with a class
definition, replicating the RubyGenerator._wrapWithClass logic for
forFileOutput=true. Includes 18 unit tests covering sprite/stage
targets, set_xxx generation, and class detection.

Refs #291

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add a menu item in the More (⋯) menu that wraps the current editor
code with a class definition. Uses executeEdits for Undo support.
Includes Japanese translations (kanji + hiragana).

Refs #291

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@github-actions
Copy link

@takaokouji takaokouji merged commit ab80e65 into develop Mar 13, 2026
9 checks passed
@takaokouji takaokouji deleted the feature/insert-class-button branch March 13, 2026 05:22
github-actions bot pushed a commit that referenced this pull request Mar 13, 2026
…t-class-button

feat: add class insertion button to Ruby tab More menu
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.

feat: add class insertion button to Ruby tab More menu

1 participant