Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VSCode Solargraph + RVM using wrong Ruby framework #243

Open
phroph opened this issue Mar 24, 2022 · 4 comments
Open

VSCode Solargraph + RVM using wrong Ruby framework #243

phroph opened this issue Mar 24, 2022 · 4 comments

Comments

@phroph
Copy link

phroph commented Mar 24, 2022

I have what seems like a regression of an older bug when using RVM: #63

I can see that in all terminals, windows (including VS term), ruby is properly set to 2.7.5, and solargraph is working.

I've tried:

  • Verifying all the paths of Ruby/Solargraph executables inside VS Code
  • Ran with and without bundler (adding Solargraph to our Gemfile)
  • Ran with and without full paths (bundler, solargraph, and ruby interpreter)
  • Verified solargraph socket runs successfully
  • Launching from code .
  • Re-setting RVM with rvm use 2.7.5 --default before above

I have (according to VS terminal):

  • solargraph -v 0.44.3
  • ruby -v ruby 2.7.5p203 (2021-11-24 revision f69aeb8314) [x86_64-darwin21]
  • which ruby /Users/phuff/.rvm/rubies/ruby-2.7.5/bin/ruby

I just get a message along the lines of (without using bundler)

System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/dependency.rb:311:in `to_specs': Could not find 'benchmark' (>= 0) among 374 total gem(s) (Gem::MissingSpecError)
Checked in 'GEM_PATH=/Users/phuff/.rvm/gems/ruby-2.7.5:/Users/phuff/.rvm/rubies/ruby-2.7.5/lib/ruby/gems/2.7.0', execute `gem env` for more information
	from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/specification.rb:1449:in `block in activate_dependencies'
	from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/specification.rb:1438:in `each'
	from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/specification.rb:1438:in `activate_dependencies'
	from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/specification.rb:1420:in `activate'
	from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems.rb:304:in `block in activate_bin_path'
	from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems.rb:303:in `synchronize'
	from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems.rb:303:in `activate_bin_path'
	from /Users/phuff/.rvm/gems/ruby-2.7.5/bin/solargraph:23:in `<main>'
	from /Users/phuff/.rvm/gems/ruby-2.7.5/bin/ruby_executable_hooks:22:in `eval'
	from /Users/phuff/.rvm/gems/ruby-2.7.5/bin/ruby_executable_hooks:22:in `<main>'

Clearly it's hitting the correct solargraph executable and then immediately using the Ruby.framework 2.6 activate_bin_path. My workspace also has .ruby-version which is correctly set to 2.7.5.

Not sure where to go from here because the linked original ticket involves making a change to a utils file in node_modules, but I don't see that anymore (also it's been more than 3 years since that ticket).

@alanwilter
Copy link

alanwilter commented Apr 26, 2022

I have the same issue. Using macOS 11.6.5.

VSCode

Version: 1.66.2
Commit: dfd34e8260c270da74b5c2d86d61aee4b6d56977
Date: 2022-04-11T07:49:20.994Z
Electron: 17.2.0
Chromium: 98.0.4758.109
Node.js: 16.13.0
V8: 9.8.177.11-electron.0
OS: Darwin x64 20.6.0

Ruby setup

ruby 3.2.0preview1 (2022-04-03 master f801386f0c) [x86_64-darwin20]
solargraph 0.44.3
.ruby-version ruby-3.2.0

@alanwilter
Copy link

It's now working and the solution is to use "wrappers".

VSCode settings.json:

  "solargraph.transport": "stdio",
  "solargraph.formatting": true,
  "solargraph.diagnostics": true,
  "solargraph.commandPath": "/Users/alan/.rvm/wrappers/default/solargraph",

@phroph
Copy link
Author

phroph commented Apr 27, 2022

Nice find! I'll give that a shot when I have a chance and see if that resolves my issue. I had bit the bullet and was using RubyMine in the short-term, rather than fiddle with this too much.

@denkoleda
Copy link

Huge thanks @alanwilter! I've spend more than an hour trying to wrap my head around it...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants