Closed Mathiou04 closed 5 years ago
Are you starting VS Code in a workspace (i.e., opening a folder) or opening the Ruby file standalone?
@castwide same issue happens with me. it's when opening a workspace.
@ianks Are you using rvm or rbenv? If so, is the solargraph gem installed on whatever version of Ruby the workspace is configured to use? vscode-solargraph will attempt to use the configured version, such as the one specified by the .ruby-version
file in your workspace, instead of the system Ruby.
Same with me. When opening a workspace. I'm using rbenv and I have the correct gem installed. It does eventually load after a few minutes of 100% cpu usage.
@landoncope That sounds like it's running correctly other than taking an inordinately long time to initialize.
Are you using the most recent version of the gem?
How large is your workspace? e.g., number of files, lines of code, etc.
You might be able to reduce the initialization time by excluding files that don't need to be mapped. The default configuration, for example, excludes spec
, test
, and vendor
directories. Run solargraph config
to generate a .solargraph.yml file with the default settings.
I’m using rbenv which is set in the .ruby-version as well as the global default. i’ve instructed both vscode-ruby and solargraph-vscode to useBundler
, with solar graph added to the gem file. Vscode is configured to use ZSH.
i don’t see any solar graph output in the debug log, and the error message does not give any useful output. both of those things would help a ton 😄
Version 0.18.0 might fix this issue. It changes how the extension starts processes under zsh.
I am using version 0.18.0 with zsh shell on Mac and having same problem. VS code says "Starting the Solargraph language server" and it stays there forever. No change in CPU or ram usage.
I did used Solargraph few days back (like 2 weeks) and it worked correctly. I was trying out other ruby extensions so I deleted it and now it's not working after reinstalling.
@pradosh987 Some things that might help:
solargraph.commandPath
to the absolute path of the solargraph
executable. (My goal is to make this step unnecessary in most cases, but if nothing else works, it should bypass problems with the shell.)Thanks @castwide It kind of worked. If I specify commandPath and install Solargraph gem in default gemset then everything works. Problem seems to be with bundler and zsh. Does this mean Solargraph will only detected gems installed in default gemset and the actual gemset used for rails development is ignored? Below is my logs.
INFO no standard startup: not just one text editor
/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.main.js:294 [Extension Host] vscode-icons is active!
workbench.main.js:sourcemap:294 [Extension Host] zsh:1: command not found: bundle
I hit so many issues while trying to install solargraph on Windows 10 - jumping through multiple threads. I thought maybe I'd combine everything I did here to help share.
Disclosure: I'm new to Ruby and VSCode. (looking forward to using squib!)
gem install solargraph
initially failed because MSYS was not installed.
I could not run MSYS because my PowerShell had restricted Security policy.
Set-ExecutionPolicy Unrestricted
fixed this. (yes, probably not safe)
I was then able to run ridk install
The update to MSYS failed due to libcats being in conflict.
So in the MSYS console that was freshly installed I ran pacman -Syu
manually which allowed me to remove and install the update AND the development toolchain
Finally, I was able to go back and complete gem install solargraph
Restarting VSCode I now had issues with eventmachine so I ran
gem uninstall eventmachine
gem install eventmachine --platform ruby
Restart VSCode
Finally get a Solargraph is listening PORT=63981 PID=3188
I don't know if this will help any or if its relevant to this thread but this is the first result that comes up in google and would have saved me 3hrs - hope it saves someone else.
☮️
@charltona Thanks for the information. I haven't run into the MSYS policy issue myself, but I did run into another permission issue that I could only resolve by uninstalling and reinstalling Ruby. I also still needed to install eventmachine with gem install eventmachine --platform ruby -- --use-system-libraries
. For a while I've been wondering if I could replace eventmachine with something else, but I haven't found an alternative besides rolling my own.
Welp, I rolled my own.
Solargraph will start using Backport for language server transports. This should eliminate the hassles with installing EventMachine on Windows.
More information: castwide/solargraph#118
@pradosh987 Some things that might help:
- Make sure you're running the latest version of the gem (0.29.4.).
- Check the developer console (Help -> Toggle Developer Tools) for error messages.
- Try setting
solargraph.commandPath
to the absolute path of thesolargraph
executable. (My goal is to make this step unnecessary in most cases, but if nothing else works, it should bypass problems with the shell.)
Hello, apologies if I did not provide enough info as I am incredibly new to VSCode, Ruby, rails and etc; please let me know if you need more.
I'm experiencing the same issue as the OP: I'm running ruby 2.5.3 (rbenv), macOS Mojave 10.14.2, VSCode 1.30.1, Ruby Solargraph 0.19.0
I apologise but I'm not sure how to complete your step #3. Could you please advise how?
In the developer tools, these are the following errors
[Extension Host] Expanded command for shell /bin/bash Array(3)
console.ts:134 [Extension Host] /bin/bash: solargraph: command not found
console.ts:134 [Extension Host] Error starting socket provider /bin/bash: solargraph: command not found
@shawnkoh What happens when you run solargraph -v
from a command line?
Make sure you gem install solargraph
from the same Ruby version that you're running from VS Code. For example, if your project has a .ruby-version file, that version needs to have Solargraph installed.
As for #3, solargraph.commandPath
is a configuration setting. On Mac, go to Code ->Preferences -> Settings. If you're able to run solargraph
from a command line, you can try setting solargraph.commandPath
to whatever path you get from running which solargraph
.
In case it helps anyone else, I was still getting this error even after I'd installed solargraph, but restarting VSCode solved it.
Still having this kind of problem. Using OSX here.
after this
try setting solargraph.commandPath to whatever path you get from running which solargraph.
have another problem: 'find_spec_for_exe': can't find gem solargraph (>= 0.a) with executable solargraph (Gem::GemNotFoundException)
In my case I got this error: rbenv: cannot rehash: ~/.rbenv/shims/.rbenv-shim exists
I had to manually delete .rbenv-shim
and then run again rbenv rehash
in order to add solargraph to ~/.rbenv/shims/solargraph
folder.
OS: macOS 10.11.5 ruby: 2.2.3 (set by rbenv) solargraph gem: 0.25.0 vscode: 1.26.1 Ruby Solargraph: 0.17.6
When loading a ruby file in vscode, there is a popup message at the bottom right:
Failed to start Solargraph:
.solargraph socket
givesSolargraph is listening PORT=7658 PID=6749
In the console, there is no message but the end of the stack:
t.onDidNotificationChange @ /Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.main.js:2386
I had my hosts file overriding the 127.0.0.1 but removed it, restarted the laptop and it didn't solve the issue.