| title | Syncfusion Code Studio Languages |
|---|---|
| description | Professional guide for Ruby development and debugging setup in Code Studio |
| classification | User Guide - Troubleshoot |
| platform | syncfusion-code-studio |
| keywords | Ruby, debugging, development, troubleshoot, code-studio, syncfusion |
This comprehensive guide will help you set up Ruby development and debugging in Code Studio.
Before setting up Ruby development in Code Studio, ensure you have the following prerequisites:
- Download Ruby from rubyinstaller.org
- Choose Ruby+Devkit version (recommended: Ruby 3.1 or higher)
- During installation:
- Check "Add Ruby executables to your PATH"
- Accept the default installation directory
Open PowerShell as Administrator and run the following commands:
ruby --version
gem --versionIf any command fails or shows an error, restart your terminal or computer and try again.
Open PowerShell as Administrator and execute the following commands:
# Update RubyGems system
gem update --system
# Install Rails framework (optional, if needed for your projects)
gem install railsTo enable Ruby development and debugging in Code Studio, you need to install the following extensions:
- Purpose: Provides language server protocol support for Ruby, including syntax highlighting, code completion, and IntelliSense
- Installation: Search for "Ruby LSP Extension Documentation" in the Extensions view (Ctrl+Shift+X)
- Purpose: Enables debugging capabilities for Ruby applications with breakpoints, variable inspection, and step-through debugging
- Installation: Search for "VSCode rdbg Ruby Debugger Documentation" in the Extensions view (Ctrl+Shift+X)
- Open Code Studio
- Navigate to Extensions view (Ctrl+Shift+X)
- Search for and install both "Ruby LSP" and "VSCode rdbg Ruby Debugger" extensions
- Restart Code Studio to activate the extensions
Install the necessary debugging gem:
# For Ruby debugging support
gem install debugOnce you have completed the setup, you can start working with Ruby projects in Code Studio:
Use one of the following methods to open your Ruby project:
- File Menu: Go to
File > Open Folderand select your Ruby project directory - Command Palette: Press
Ctrl+Shift+P, type "Open Folder", and select your project directory - Drag and Drop: Drag your project folder directly into Code Studio
- Run Ruby File Directly:
- Open your Ruby file (
.rb) - Press
Ctrl+F5to run without debugging - Or right-click in the editor and select "Run Ruby"
- Open your Ruby file (
-
Open Integrated Terminal:
- Press `Ctrl+`` (backtick) to open the terminal
- Navigate to your file directory if needed
-
Run the Ruby File:
# Run a single Ruby file ruby filename.rb
- Debug Ruby File Directly:
- Open your Ruby file (
.rb) - Press
F5to run with debugging - Or right-click in the editor and select "Debug Ruby"
- Open your Ruby file (
-
Set Up Debug Configuration:
- Open Run and Debug view (
Ctrl+Shift+D) - Click "Run and Debug" button
- Click the "create a launch.json file" link
- Select "Ruby rdbg" from the dropdown menu
- Choose "Debug current file with rdbg" option
- Open Run and Debug view (
-
Launch Debug Session:
- Code Studio will execute your Ruby file with debugging capabilities
- The debug toolbar will appear at the top of the editor
Once debugging is active, you can use the following features:
- Set Breakpoints: Click in the gutter next to line numbers or press
F9 - Step Through Code:
F10- Step OverF11- Step IntoShift+F11- Step OutF5- Continue
- Inspect Variables: Hover over variables or use the Variables panel
- Watch Expressions: Add expressions to the Watch panel
- Debug Console: Evaluate Ruby expressions during debugging
Problem: When running ruby --version, you get "'ruby' is not recognized as an internal or external command"
Solutions:
- Restart Code Studio and your computer after Ruby installation
- Verify Ruby is installed and added to PATH:
# Check if Ruby is in PATH echo $env:PATH # Manually add Ruby to PATH if needed (adjust path as needed) $env:PATH += ";C:\Ruby32-x64\bin"
- Reinstall Ruby with "Add Ruby executables to your PATH" option checked
Problem: Clicking F5 or "Run and Debug" doesn't start debugging session
Solutions:
- Install the
debuggem:gem install debug - Verify Code Studio rdbg Ruby Debugger extension is installed and enabled
- Check if
launch.jsonconfiguration is correct - Try creating a new
launch.jsonfile:- Open Run and Debug view (
Ctrl+Shift+D) - Click "create a launch.json file"
- Select "Ruby rdbg"
- Open Run and Debug view (
- Restart Code Studio after installing extensions
Problem: Breakpoints are set but debugger doesn't stop at them
Solutions:
- Ensure you're running with debugging (
F5) not just running (Ctrl+F5) - Verify the
debuggem is installed:gem list debug - Check that breakpoints are set on executable lines (not comments or empty lines)
- Make sure your Ruby file is saved before debugging
- Reload the window: Press
Ctrl+Shift+Pand type "Developer: Reload Window" - For advanced debugging techniques, refer to this Ruby trace inspector guide