Setup Vscode
Installation
If you don't yet have VS Code installed on your computer, head to code.visualstudio.com to download it. You can open the dropdown to choose the version you want to download, but usually, the big button should do the work.
Extensions and settings for Ruby on Rails Developers
Ruby is built with developer happiness in mind. However, if your editor is not correctly set up, you’re in for a painful ride. Finding the right extensions on VS Code can take you down a long trial-and-error path.
Here's a list of powerful extensions for Ruby on Rails developers.
Extensions:
- Ruby (basic ruby support)
- Solargraph (linter, autocomplete) (You need to install the Ruby gem:
gem install solargraph
) - Rubocop (linter) (You need to install the Ruby gem:
gem install rubocop
) - GitLens (git visibility)
- Live Share (pair programming )
- RSpec Snippets (test snippets)
- Erb (html.erb support)
code --install-extension rebornix.ruby code --install-extension castwide.solargraph code --install-extension misogi.ruby-rubocop code --install-extension eamodio.gitlens code --install-extension ms-vsliveshare.vsliveshare code --install-extension ldrner.rspec-snippets-vscode code --install-extension riey.erb
You can install these through command line, one by one using the command: code --install-extension $EXT_NAME
.
Recommended settings for VSCode:
"ruby.useLanguageServer": true, "ruby.format": "rubocop", "ruby.intellisense": "rubyLocate", "ruby.useBundler": true, "ruby.rubocop.useBundler": true, "[ruby]": { "editor.defaultFormatter": "misogi.ruby-rubocop" }, "editor.tabSize": 2, "files.insertFinalNewline": true, "telemetry.enableTelemetry": false, "window.titleBarStyle": "custom", "files.trimTrailingWhitespace": true,
Add these settings in File > Preferences > Settings
(open the settings in json).