Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save lcuevastodoit/839f6caf2fc6c43b9836383ad542f6d1 to your computer and use it in GitHub Desktop.
Save lcuevastodoit/839f6caf2fc6c43b9836383ad542f6d1 to your computer and use it in GitHub Desktop.
Setup Visual Studio Code Ruby on Rails debugger with webpack-dev-server autolaunch

Visual Studio Code Ruby on Rails debugger with webpack-dev-server autolaunch

  1. Both files needs to be specified for every workspace
  2. Install gem ruby-debug-ide gem install ruby-debug-ide
  3. If using rvm make sure to have correctly setup paths or open workspace from terminal with code .
  4. With rbenv everything should work out of the box
  5. You can now run rails server with pressing button (or ctrl+shift+d) and webpack-dev-server will start automatically on background.

Notes: Please note, when you stop debug server, webpack-dev-server remain running in terminal (because it's background job). Without promlemMatcher specified in tasks.json, solution not working. ( more here https://stackoverflow.com/a/54017304/3442759 )

{
"version": "0.2.0",
"configurations": [
{
"name": "Rails server",
"type": "Ruby",
"request": "launch",
"program": "${workspaceRoot}/bin/rails",
"args": [
"server"
],
"preLaunchTask": "webpack-dev-server",
"postDebugTask": "postdebugKill"
}
]
}
{
"version": "2.0.0",
"tasks": [
{
"label": "webpack-dev-server",
"type": "shell",
"isBackground": true,
"command": "./bin/webpack-dev-server",
"problemMatcher": [
{
"pattern": [
{
"regexp": ".",
"file": 1,
"location": 2,
"message": 3
}
],
"background": {
"activeOnStart": true,
"beginsPattern": ".",
"endsPattern": ".",
}
}
]
},
{
"label": "postdebugKill",
"type": "process",
"command": [
"${command:workbench.action.tasks.terminate}",
"${command:workbench.action.acceptSelectedQuickOpenItem}",
],
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment