Quantcast
Channel: Active questions tagged visual-studio-code - Stack Overflow
Viewing all articles
Browse latest Browse all 99112

Can't debug rake task in VS Code

$
0
0

I configured my environment properly to debug rails apps in VS Code.

It works fine for debug Rails Server. When I start the debug, it boots the server and stop at the breakpoints that I have marked.

But, I can't figure out how to debug local files, like rake tasks. It even runs the task, but it does not stop at the breakpoints.

Below is how I set up my environment.

Ubuntu running on WSL2.
VSCode running on windows

Installed the extension:

Remote - WSL from Microsoft
Ruby from PengLv

Installed gems:

gem install ruby-debug-ide
gem install debase

Gemfile:

gem 'ruby-debug-ide'
gem 'debase'`

Configuration for debug local file at /.vscode/launch.json:

{
  // Use IntelliSense to learn about possible attributes.
  // Hover to view descriptions of existing attributes.
  // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
  "version": "0.2.0",
  "configurations": [
    {
      "name": "Rake fd:test",
      "type": "Ruby",
      "request": "launch",
      "cwd": "${workspaceRoot}",
      "program": "${workspaceRoot}/bin/rake",
      "useBundler": true,
      "args": ["fd:test"]
    }
  ]
}

Rake task itself at /lib/taks/fd.rake:

namespace :fd do
  task test: :environment do
    a = 10
    p "teste"
    b = 20
    c = 30
  end
end

The configuration for debug Rails server that works properly, just for comparation, is:

{
  // Use IntelliSense to learn about possible attributes.
  // Hover to view descriptions of existing attributes.
  // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
  "version": "0.2.0",
  "configurations": [

    {
      "name": "Rails server",
      "type": "Ruby",
      "request": "launch",
      "program": "${workspaceRoot}/bin/rails",
      "args": [
        "server"
      ]
    }
  ]
}

Like I said above, it runs the task, but does not stop on breakpoints. Anyone can help me out?


Viewing all articles
Browse latest Browse all 99112

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>