castwide / vscode-solargraph

A Visual Studio Code extension for Solargraph.
Other
423 stars 25 forks source link

Honor ruby.interpreter.commandPath setting vs ruby from env PATH #195

Closed heynan0 closed 3 years ago

heynan0 commented 3 years ago

I use rbenv to manage Ruby versions. The extension works fine as .rbenv is in my path.

I have a project that uses its own Ruby version that is not anywhere in the system path (/usr/bin/ruby) nor in rbenv (~/.rbenv/shims). My VSCode <projectRoot>/.vscode/settings.json for the project workspace has the following:

{
  ...
  "ruby.interpreter.commandPath": "binaries/ruby",
  ...
}

Where ruby is found in <projectRoot>/binaries/ruby.

Because the extension uses ruby from PATH, it does not consider first trying to use ruby.interpreter.commandPath. As such I always get problems with the extension using the wrong ruby executable.

Could it be possible for the extension to honor that setting and use that Ruby executable instead of the one in $PATH environment variable?

heynan0 commented 3 years ago

I think I found a workaround by setting the relative path to the solargraph executable script at somewhere like ruby/bin/solargraph:

<projectRoot>/.vscode/settings.json

  "solargraph.bundlerPath": "binaries/bundle",
  "solargraph.useBundler": false,
  "solargraph.commandPath": "ruby/bin/solargraph"