Closed ghost closed 6 years ago
Binding to port 0 should make the OS select the next available port. Since multiple workspaces might need to run in different environments (e.g., different Ruby versions, gemsets, etc.), each instance needs to select its own port to avoid conflicts.
When the server starts correctly, the VS Code console should give you a line like this:
INFO WEBrick::HTTPServer#start: pid=##### port=#####
Solargraph-utils looks for that line to confirm that the server is running.
A previous version of the gem used Thin instead of WEBrick, which caused problems on some systems.
Solargraph extension version 0.10.3 Solargraph Gem version 0.15.4
Thanks. That's a new error for me. I'll try to reproduce it. If nothing else, it's possible for the application to select an available port instead of relying on the server handler.
I've published new versions of the gem, the VS code extension, and the solargraph-utils package. The one that's most pertinent to this issue is the gem. It uses its own routine to find an available port instead of requesting port 0 from the server handler.
Using the above mentioned latest versions (extension 0.11.0, gem 0.16.0), the original issue no longer manifests.
Thanks for the fix! I just started playing with Ruby and the lack of a working autocomplete extension for VSCode was really slowing me down.
Not sure what's causing this, but I'm unable to use the VSCode solargraph extension as a result of an error coming from this package.
From what I can tell, attempting to start on TCP port 0 is the root cause of the issue. If I set the port passed in to the solargraph process (by modifying the
Server
class manually), everything starts working fine.For example, changing this line from
var args = ['server', '--port', '0'];
tovar args = ['server', '--port', '37654'];
causes the issue to go away.OS: Arch Linux x64