Skip to content

Instantly share code, notes, and snippets.

@floptwo
Last active April 18, 2024 13:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save floptwo/fdb2df57e7e7cde3781e64de0007f5a9 to your computer and use it in GitHub Desktop.
Save floptwo/fdb2df57e7e7cde3781e64de0007f5a9 to your computer and use it in GitHub Desktop.

Source: https://stackoverflow.com/a/78071275

Make Ruby LSP work even old ruby projects.

Outside your main project, create a folder with these two files:

  • .ruby-version with a version >= 3.0.0
3.0.0
  • Gemfile
# frozen_string_literal: true

source 'https://rubygems.org'

gem 'ruby-lsp'
gem 'ruby-lsp-rails'
  • In your Ruby project, create a VSCode settings file (e.g. .vscode/settings.json)
{
  "rubyLsp.bundleGemfile": "../path/to/above/Gemfile", // or absolute path
  "rubyLsp.rubyVersionManager": "rbenv",
}
  • Install Ruby LSP plugin and restart VSCode.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment