This extension provides enhanced Ruby language and debugging support for Visual Studio Code.
- Automatic Ruby environment detection with support for rvm, rbenv, chruby, and asdf
- Lint support via RuboCop, Standard, and Reek
- Format support via RuboCop, Standard, Rufo, Prettier and RubyFMT
- Semantic code folding support
- Semantic highlighting support
- Basic Intellisense support
Search for ruby
in the VS Code Extension Gallery and install it!
By default, the extension provides sensible defaults for developers to get a better experience using Ruby in Visual Studio Code. However, these defaults do not include settings to enable features like formatting or linting. Given how dynamic Ruby projects can be (are you using rvm, rbenv, chruby, or asdf? Are your gems globally installed or via bundler? etc), the extension requires additional configuration for additional features to be available.
It is highly recommended that you enable the Ruby language server (via the Use Language Server setting or ruby.useLanguageServer
config option). The server does not default to enabled while it is under development but it provides a significantly better experience than the legacy extension functionality. See docs/language-server.md for more information on the language server.
Legacy functionality will most likely not receive additional improvements and will be fully removed when the extension hits v1.0
"ruby.useBundler": true, //run non-lint commands with bundle exec
"ruby.useLanguageServer": true, // use the internal language server (see below)
"ruby.lint": {
"rubocop": {
"useBundler": true // enable rubocop via bundler
},
"reek": {
"useBundler": true // enable reek via bundler
}
},
"ruby.format": "rubocop" // use rubocop for formatting
Reviewing the linting, formatting, and environment detection docs is recommended
For full details on configuration options, please take a look at the Ruby
section in the VS Code settings UI. Each option is associated with a name and description.
See docs/debugger.md.
docs/legacy.md contains the documentation around the legacy functionality
- Ruby Solargraph - Solargraph is a language server that provides intellisense, code completion, and inline documentation for Ruby.
- VSCode Endwise - Wisely add "end" in Ruby