Closed wagenet closed 5 years ago
Thanks for looking into this.
The reason for the -l
parameter is that rvm on some systems will only work with a login shell. I just ran the following test on MacOS with rvm:
ruby-2.4.1
.-l
parameter: The process uses Ruby 2.4.1 as per .ruby-version and Solargraph starts.-l
parameter: The process uses Ruby 2.4.0 and reports that Solargraph was not found.If it works on your system without the -l
parameter, we'll need to determine if there's some difference in the rvm setups or the shell being used to launch VS Code or something else.
Can you tell me what process.env
reports in the developer console?
@castwide so this is probably stupid, but I had trouble figuring out how to open the developer console you refer to. Can you direct me?
Sorry. It's in VS Code. Go to Help -> Toggle Developer Tools. The tools should look familiar if you've ever used the developer tools in Chrome or Firefox. There's a JavaScript console with a >
prompt where you can execute JavaScript code. Run process.env
from there.
Aha! I had missed that toggle.
{
"MANPATH":"/Users/peterwagenet/.nvm/versions/node/v8.11.3/share/man:/usr/local/share/man:/usr/share/man:/opt/X11/share/man:/Library/Frameworks/Mono.framework/Versions/Current/share/man:/Applications/Xcode-beta.app/Contents/Developer/usr/share/man:/Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/share/man",
"rvm_use_flag":"",
"rvm_bin_path":"/Users/peterwagenet/.rvm/bin",
"TERM_PROGRAM":"iTerm.app",
"rvm_quiet_flag":"",
"GEM_HOME":"/Users/peterwagenet/.rvm/gems/ruby-2.5.1",
"NVM_CD_FLAGS":"-q",
"rvm_gemstone_url":"",
"TERM":"xterm-256color",
"SHELL":"/bin/zsh",
"rvm_docs_type":"",
"IRBRC":"/Users/peterwagenet/.rvm/rubies/ruby-2.5.1/.irbrc",
"TMPDIR":"/var/folders/28/0xjbyc3d2dnfj7hbzpzd8d780000gn/T/",
"NVM_PATH":"/Users/peterwagenet/.nvm/versions/node/v8.11.3/lib/node",
"Apple_PubSub_Socket_Render":"/private/tmp/com.apple.launchd.9th4j774gr/Render",
"TERM_PROGRAM_VERSION":"3.1.7",
"rvm_hook":"",
"MY_RUBY_HOME":"/Users/peterwagenet/.rvm/rubies/ruby-2.5.1",
"TERM_SESSION_ID":"w0t0p1:22004528-51D6-4D3E-A52B-EA59D8C37B88",
"ZSH":"/Users/peterwagenet/.oh-my-zsh",
"NVM_DIR":"/Users/peterwagenet/.nvm",
"USER":"peterwagenet",
"rvm_gemstone_package_file":"",
"_system_type":"Darwin",
"COMMAND_MODE":"unix2003",
"rvm_path":"/Users/peterwagenet/.rvm",
"SSH_AUTH_SOCK":"/private/tmp/com.apple.launchd.EgSRWc1RX3/Listeners",
"__CF_USER_TEXT_ENCODING":"0x1F5:0x0:0x0",
"rvm_proxy":"",
"rvm_ruby_file":"",
"PAGER":"less",
"LSCOLORS":"Gxfxcxdxbxegedabagacad",
"rvm_silent_flag":"",
"rvm_prefix":"/Users/peterwagenet",
"rvm_ruby_make":"",
"PATH":"/Users/peterwagenet/.rvm/gems/ruby-2.5.1/bin:/Users/peterwagenet/.rvm/gems/ruby-2.5.1@global/bin:/Users/peterwagenet/.rvm/rubies/ruby-2.5.1/bin:/Users/peterwagenet/.rvm/bin:/Users/peterwagenet/.nvm/versions/node/v8.11.3/bin:/Users/peterwagenet/.cargo/bin:/Users/peterwagenet/bin:/usr/local/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/VMware Fusion.app/Contents/Public:/opt/X11/bin:/Library/Frameworks/Mono.framework/Versions/Current/Commands:/Users/peterwagenet/.yarn/bin:/Users/peterwagenet/.erlangInstaller/19.3/bin",
"NVM_NODEJS_ORG_MIRROR":"https://nodejs.org/dist",
"PWD":"/Users/peterwagenet/Development/Tilde/Skylight/direwolf-client",
"rvm_sdk":"",
"LANG":"en_US.UTF-8",
"ITERM_PROFILE":"Default",
"_system_arch":"x86_64",
"XPC_FLAGS":"0x0",
"_system_version":"10.14",
"XPC_SERVICE_NAME":"0",
"rvm_version":"1.29.3 (master)",
"rvm_script_name":"",
"rvm_pretty_print_flag":"",
"SHLVL":"2",
"HOME":"/Users/peterwagenet",
"COLORFGBG":"7;0",
"rvm_ruby_mode":"",
"ITERM_SESSION_ID":"w0t0p1:22004528-51D6-4D3E-A52B-EA59D8C37B88",
"LESS":"-R",
"LOGNAME":"peterwagenet",
"rvm_alias_expanded":"",
"GEM_PATH":"/Users/peterwagenet/.rvm/gems/ruby-2.5.1:/Users/peterwagenet/.rvm/gems/ruby-2.5.1@global",
"LC_CTYPE":"en_US.UTF-8",
"NVM_BIN":"/Users/peterwagenet/.nvm/versions/node/v8.11.3/bin",
"rvm_nightly_flag":"",
"NVM_IOJS_ORG_MIRROR":"https://iojs.org/dist",
"rvm_ruby_make_install":"",
"rvm_niceness":"",
"DISPLAY":"/private/tmp/com.apple.launchd.hP3kWPhziw/org.macosforge.xquartz:0",
"rvm_ruby_bits":"",
"rvm_bin_flag":"",
"rvm_only_path_flag":"",
"RUBY_VERSION":"ruby-2.5.1",
"SECURITYSESSIONID":"186a7",
"_system_name":"OSX",
"COLORTERM":"truecolor",
"_":"/Applications/Visual Studio Code.app/Contents/MacOS/Electron",
"VSCODE_CLI":"1",
"ELECTRON_NO_ATTACH_CONSOLE":"1",
"GOOGLE_API_KEY":"AIzaSyAQfxPJiounkhOjODEO5ZieffeBv6yft2Q",
"VSCODE_NLS_CONFIG":"{\"locale\":\"en-us\",\"availableLanguages\":{}}",
"VSCODE_NODE_CACHED_DATA_DIR_3215":"/Users/peterwagenet/Library/Application Support/Code/CachedData/1dfc5e557209371715f655691b1235b6b26a06be",
"VSCODE_LOGS":"/Users/peterwagenet/Library/Application Support/Code/logs/20180721T112303",
"VSCODE_IPC_HOOK":"/Users/peterwagenet/Library/Application Support/Code/1.25.1-main.sock",
"VSCODE_PID":"3215"
}
Thanks for the info. I'm still looking for a way to accommodate both scenarios (with and without an explicit login). I'd prefer a way to automate the selection, but it might require a configuration option instead.
@castwide Do you know what would be different about my RVM setup that would make the login shell not work vs the cases where it does work? I also do have a .ruby-version
file pointing with 2.5.1
but when I try to use the login shell it runs with the system ruby. Also, I'm using zsh, though it doesn't seem like that should matter.
I'm not sure yet. I've been comparing your environment variables to those on a MacOS where the login shell works and haven't seen any significant differences.
Are you opening your project as a workspace folder in VS Code? That should be all that's required for solargraph-utils to follow the .ruby-version file at its root.
It should work the same with either bash or zsh, but I'll run some tests to confirm.
@castwide I'm just doing code .
from the root of my project.
Yeah, that should totally work. I'll switch to zsh and try to reproduce the problem.
Not only does this appear to be unnecessary, it also prevents ENV vars from being inherited. This is problematic especially in the case where RVM is being used.
Fixes https://github.com/castwide/vscode-solargraph/issues/63