LoginSignup
0
0

More than 1 year has passed since last update.

Ruby AtCoder向けVSCode設定 __debug__(ruby 3.2版)

Posted at

はじめに

以前投稿しました、Ruby AtCoder向けVSCode設定はruby 2.7版でした。

しかし、ruby 3.0以降 ですと、debaseのインストールに失敗することが分かっています。

ruby 3.0.2p107 (2021-07-07 revision 0db68f0233) [x64-mingw32]

An error occurred while installing debase (0.2.4.1), and Bundler cannot
continue.

そこで、Atcoder のアップデート予定版である、ruby 3.2でdebug環境の構築に取り組みます。

構築順

すでに、記事が投稿されていますので、そちらも参照願います。

ちなみに、私の環境は次の通りです。

Microsoft Windows [Version 10.0.19045.2846]
(c) Microsoft Corporation. All rights reserved.

C:\Users\user>ruby -v
ruby 3.2.2 (2023-03-30 revision e51014f9c0) [x64-mingw-ucrt]

C:\Users\user>gem list
debug (1.7.2)

VSCodeに拡張機能VSCode rdbg Ruby Debuggerがインストールされた状態(launch.jsonが作成されていない!)で、F5キーを押下しますと、デバッグ実行されます。

20230429a.png

補足

初めはscoop内にrubyをインストールしていたのですが、debugが上手くインストールされなかったので、RubyInstaller for Windowsを使用しています。

VSCode launch.json 設定例

テキストファイルから、入力を受け取るように修正します。

launch.json
{
    // IntelliSense を使用して利用可能な属性を学べます。
    // 既存の属性の説明をホバーして表示します。
    // 詳細情報は次を確認してください: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "type": "rdbg",
            "name": "Debug current file with rdbg",
            "request": "launch",
            "script": "${file}",
            "args": [
                "input.txt"
            ],
            "askParameters": false,
            "useTerminal": true
        },
        {
            "type": "rdbg",
            "name": "Attach with rdbg",
            "request": "attach"
        }
    ]
}

20230429b.png

(σ・∀・)σ gets!!

まとめ

  • Windows10 の VSCode の Ruby 3.2 でデバッグができるようになった
  • AtCoder様、言語アップデートの受け入れ準備はOKです
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0