What is the secret sauce to using RVM and VSCode and Rubocop with less trouble. While it is possible to get it to work smoothly, there are pitfalls. As an example, I have a project open where it is currently Ruby 2.7.2 yet VSCode is complaining internally:
/Users/futz/.rvm/gems/ruby-2.6.5/gems/bundler-2.1.4/lib/bundler/definition.rb:495:in `validate_ruby!': Your Ruby version is 2.6.5, but your Gemfile specified 2.7.2 (Bundler::RubyVersionMismatch)
So why does VSCode think my Ruby version is 2.6.5 when this whole project is clearly 2.7.2? Because RVM. So what do people do? I have wasted a lot of time on this, and it is most devlish to get it clean. There is a repeatable trick, but it escapes me the elegant solution?
Start vcscode from the commandline in the project directory where RVM is configured in. That鈥檚 the only way to get vscode aware of rvm installed rubies and gems that I have found working.
Fyi there鈥檚 also this bug: https://github.com/rubyide/vscode-ruby/issues/451
Workaround is to install eg Solargraph in the global gemset since vscode-ruby probably does not work well with the project gemset.
This issue has not had activity for 30 days. It will be automatically closed in 7 days.
Most helpful comment
Start vcscode from the commandline in the project directory where RVM is configured in. That鈥檚 the only way to get vscode aware of rvm installed rubies and gems that I have found working.