Operating System
Ubuntu 20.04.5 LTS (WSL2)
Ruby version
3.1.2
Project has a bundle
Ruby version manager being used
asdf
Description
When I install the vscode extension, the Ruby LSP server crashes with the following information in the output tab:
2024-01-29 17:08:04.389 [info] (api) Trying to activate Ruby environment with command: /bin/bash -i -c 'asdf exec ruby -rjson -e "STDERR.printf(%{RUBY_ENV_ACTIVATE%sRUBY_ENV_ACTIVATE}, JSON.dump({ env: ENV.to_h, ruby_version: RUBY_VERSION, yjit: defined?(RubyVM::YJIT) }))"' inside directory: /home/user/project/api
2024-01-29 17:08:04.932 [info] (api) bundler: command not found: ruby-lsp
Install missing gem executables with `bundle install`
2024-01-29 17:08:04.943 [info] (api) [Error - 5:08:04 PM] Server initialization failed.
2024-01-29 17:08:04.943 [info] (api) Message: Pending response rejected since connection got disposed
Code: -32097
2024-01-29 17:08:04.943 [info] (api) [Info - 5:08:04 PM] Connection to server got closed. Server will restart.
2024-01-29 17:08:04.943 [info] (api) true
2024-01-29 17:08:04.943 [info] (api) [Error - 5:08:04 PM] Ruby LSP client: couldn't create connection to server.
2024-01-29 17:08:04.943 [info] (api) Message: Pending response rejected since connection got disposed
Code: -32097
2024-01-29 17:08:04.948 [info] (api) [Error - 5:08:04 PM] Server process exited with code 127.
2024-01-29 17:08:05.064 [info] (api) bundler: command not found: ruby-lsp
Install missing gem executables with `bundle install`
When I install the ruby-lsp gem globally to try to avoid the error (which I know is not how I'm supposed to be installing it), I then get the following errors when I launch vscode:
2024-01-29 17:14:45.287 [info] (api) Trying to activate Ruby environment with command: /bin/bash -i -c 'asdf exec ruby -rjson -e "STDERR.printf(%{RUBY_ENV_ACTIVATE%sRUBY_ENV_ACTIVATE}, JSON.dump({ env: ENV.to_h, ruby_version: RUBY_VERSION, yjit: defined?(RubyVM::YJIT) }))"' inside directory: /home/username/project/api
2024-01-29 17:14:45.805 [info] (api) bundler: failed to load command: ruby-lsp (/home/username/.asdf/installs/ruby/3.1.2/bin/ruby-lsp)
2024-01-29 17:14:45.805 [info] (api) /home/username/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.24/lib/bundler/rubygems_integration.rb:308:in `block in replace_bin_path': can't find executable ruby-lsp for gem ruby-lsp. ruby-lsp is not currently included in the bundle, perhaps you meant to add it to your Gemfile? (Gem::Exception)
from /home/username/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.24/lib/bundler/rubygems_integration.rb:336:in `block in replace_bin_path'
from /home/username/.asdf/installs/ruby/3.1.2/bin/ruby-lsp:25:in `<top (required)>'
from /home/username/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.24/lib/bundler/cli/exec.rb:58:in `load'
from /home/username/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.24/lib/bundler/cli/exec.rb:58:in `kernel_load'
from /home/username/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.24/lib/bundler/cli/exec.rb:23:in `run'
from /home/username/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.24/lib/bundler/cli.rb:486:in `exec'
from /home/username/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.24/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
from /home/username/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.24/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
from /home/username/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.24/lib/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
from /home/username/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.24/lib/bundler/cli.rb:31:in `dispatch'
from /home/username/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.24/lib/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
from /home/username/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.24/lib/bundler/cli.rb:25:in `start'
from /home/username/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.24/exe/bundle:48:in `block in <top (required)>'
from /home/username/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.24/lib/bundler/friendly_errors.rb:120:in `with_friendly_errors'
from /home/username/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.24/exe/bundle:36:in `<top (required)>'
from /home/username/.asdf/installs/ruby/3.1.2/bin/bundle:25:in `load'
from /home/username/.asdf/installs/ruby/3.1.2/bin/bundle:25:in `<main>'
2024-01-29 17:14:45.816 [info] (api) [Error - 5:14:45 PM] Server initialization failed.
2024-01-29 17:14:45.816 [info] (api) Message: Pending response rejected since connection got disposed
Code: -32097
2024-01-29 17:14:45.816 [info] (api) [Info - 5:14:45 PM] Connection to server got closed. Server will restart.
2024-01-29 17:14:45.816 [info] (api) true
2024-01-29 17:14:45.816 [info] (api) [Error - 5:14:45 PM] Ruby LSP client: couldn't create connection to server.
2024-01-29 17:14:45.816 [info] (api) Message: Pending response rejected since connection got disposed
Code: -32097
2024-01-29 17:14:45.825 [info] (api) [Error - 5:14:45 PM] Server process exited with code 1.
2024-01-29 17:14:46.004 [info] (api) bundler: failed to load command: ruby-lsp (/home/username/.asdf/installs/ruby/3.1.2/bin/ruby-lsp)
Finally, when I try to start the server by running ruby-lsp, I get the same "command not found" message if I have not installed the ruby-lsp gem globally, but once I install it globally myself, starting the server by running ruby-lsp works, just not in vscode.
Operating System
Ubuntu 20.04.5 LTS (WSL2)
Ruby version
3.1.2
Project has a bundle
Ruby version manager being used
asdf
Description
When I install the vscode extension, the Ruby LSP server crashes with the following information in the output tab:
When I install the ruby-lsp gem globally to try to avoid the error (which I know is not how I'm supposed to be installing it), I then get the following errors when I launch vscode:
Finally, when I try to start the server by running ruby-lsp, I get the same "command not found" message if I have not installed the ruby-lsp gem globally, but once I install it globally myself, starting the server by running ruby-lsp works, just not in vscode.