asdf install ruby 3.4.4
mkdir ~/ruby-lsp
cd ~/ruby-lsp
echo "ruby 3.4.4" > .tool-versions
source "https://rubygems.org"
ruby "3.4.4"
gem "rubocop"
gem "rubocop-performance"
gem "rubocop-rails"
gem "rubocop-rspec"
gem "rubocop-thread_safety"
gem "ruby-lsp"
bundle install
code --install-extension Shopify.ruby-lsp
"rubyLsp.bundleGemfile": "~/ruby-lsp/Gemfile",
"rubyLsp.rubyVersionManager": {
"identifier": "asdf"
},
"rubyLsp.enabledFeatures": {
"codeActions": true,
"diagnostics": true,
"documentHighlights": true,
"documentLink": true,
"documentSymbols": true,
"foldingRanges": true,
"formatting": false,
"hover": true,
"inlayHint": true,
"onTypeFormatting": true,
"selectionRanges": true,
"semanticHighlighting": true,
"completion": true,
"codeLens": true,
"definition": true,
"workspaceSymbol": true,
"signatureHelp": true,
"typeHierarchy": true
},
If you are using a different ruby version manager, like rbenv
. Please update the rubyLsp.rubyVersionManager
config to match your version manager. And set .ruby-version
file in the ruby-lsp folder with the ruby version you want to use.