-
Notifications
You must be signed in to change notification settings - Fork 175
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
System ruby fails to start LSP #3002
Comments
Thank you for the bug report!
Can you point to where we say that? If we say it like that, then it's a mistake. You don't have to add Regarding the issue you're experiencing, I suspect it's related to the fact that you are not using a version manager and the VS Code NodeJS process likely doesn't know about the Ruby you installed manually. How did you install Ruby? And how do you add the Ruby installation to your |
https://shopify.github.io/ruby-lsp/editors.html
I might have interpreted this sentence incorrectly. I was trying to use the system installed Ruby, which is under |
Do you need sudo to install gems with that system Ruby? If so, the Ruby LSP will unfortunately not work as the process doesn't run with sudo permissions and we need to be able to install gems. We do offer options to point to a specific Ruby executable, but it will only work if sudo is not required. |
I need sudo to install ruby-lsp. |
We have some instructions on how to configure RubyGems and Bundler to install gems in specific places and to use user-install to avoid permission issues. Do those options work for you? |
Sorry for the late response. $ cat .gemrc
gem: --user-install
$ gem install ruby-lsp
ERROR: Use --install-dir or --user-install but not both That's the error I am referring to. I have no idea why Gem thinks Also, there's a Ruby Lsp: Branch option in the extension settings, which made me think if the extension was supposed to install the LSP somehow. |
Actually, I found the exact quote: https://shopify.github.io/ruby-lsp/#with-vs-code
|
This is a second kind of error I encountered. If I use a separate Gemfile for the Ruby-LSP environment: $ cat Gemfile
source "https://rubygems.org"
gem "ruby-lsp" VSCode extension claims to install the gems, but can't find them anyways: 2025-01-10 21:45:13.085 [info] (fate5d) Checking if chruby is available on the path with command: /bin/bash -i -c 'chruby --version'
2025-01-10 21:45:13.187 [info] (fate5d) Checking if rbenv is available on the path with command: /bin/bash -i -c 'rbenv --version'
2025-01-10 21:45:13.209 [info] (fate5d) Checking if rvm is available on the path with command: /bin/bash -i -c 'rvm --version'
2025-01-10 21:45:13.229 [info] (fate5d) Checking if asdf is available on the path with command: /bin/bash -i -c 'asdf --version'
2025-01-10 21:45:13.252 [info] (fate5d) Discovered version manager none
2025-01-10 21:45:13.253 [info] (fate5d) Running command: `ruby -W0 -rjson -e 'STDERR.print("RUBY_LSP_ACTIVATION_SEPARATOR" + { env: ENV.to_h, yjit: !!defined?(RubyVM::YJIT), version: RUBY_VERSION, gemPath: Gem.path }.to_json + "RUBY_LSP_ACTIVATION_SEPARATOR")'` in /home/rongcuid/src/ruby-lsp using shell: /usr/bin/bash
2025-01-10 21:45:13.515 [info] (fate5d) bundler: command not found: ruby-lsp
Install missing gem executables with `bundle install`
2025-01-10 21:45:13.546 [info] (fate5d) [Error - 9:45:13 PM] Server process exited with code 127.
2025-01-10 21:45:13.547 [info] (fate5d) [Error - 9:45:13 PM] Server initialization failed.
2025-01-10 21:45:13.547 [info] (fate5d) Message: Pending response rejected since connection got disposed
Code: -32097
2025-01-10 21:45:13.548 [info] (fate5d) [Error - 9:45:13 PM] Ruby LSP client: couldn't create connection to server.
2025-01-10 21:45:13.548 [info] (fate5d) Message: Pending response rejected since connection got disposed
Code: -32097
2025-01-10 21:45:13.548 [error] (fate5d) Error starting the server: Pending response rejected since connection got disposed |
Description
Note that the FAQ specifically says that vscode doesn't need a local gem installation of ruby-lsp.
Ruby LSP Information
VS Code Version
1.96.2
Ruby LSP Extension Version
0.8.16
Ruby LSP Server Version
Unknown
Ruby LSP Addons
Ruby Version
3.2.5
Ruby Version Manager
none
Installed Extensions
Click to expand
Ruby LSP Settings
Click to expand
Workspace
User
Reproduction steps
Gemfile
bundle install
Ruby LSP client: couldn't create connection to server.
Example Gemfile:
Code snippet or error message
The text was updated successfully, but these errors were encountered: