I'm not sure how to reproduce. I was presented with an error dialog from a VS Code window running in the background.
Description
I have the following in my "Ruby LSP" output section in VS Code. It's repeated many times but I've only pasted one cycle to keep the issue description smaller.
bundler: failed to load command: ruby-lsp (/Users/nirvdrum/.gem/ruby/3.1.2/bin/ruby-lsp)
/Users/nirvdrum/.gem/ruby/3.1.2/gems/ruby-lsp-0.5.0/lib/ruby_lsp/utils.rb:9:in `<module:RubyLsp>': undefined method `URI' for RubyLsp:Module (NoMethodError)
WORKSPACE_URI = T.let(URI("file://#{Dir.pwd}".freeze), URI::Generic) # rubocop:disable Style/RedundantFreeze
^^^
from /Users/nirvdrum/.gem/ruby/3.1.2/gems/ruby-lsp-0.5.0/lib/ruby_lsp/utils.rb:4:in `<top (required)>'
from /Users/nirvdrum/.gem/ruby/3.1.2/gems/ruby-lsp-0.5.0/lib/ruby_lsp/internal.rb:11:in `require'
from /Users/nirvdrum/.gem/ruby/3.1.2/gems/ruby-lsp-0.5.0/lib/ruby_lsp/internal.rb:11:in `<top (required)>'
from /Users/nirvdrum/.gem/ruby/3.1.2/gems/ruby-lsp-0.5.0/exe/ruby-lsp:21:in `require_relative'
from /Users/nirvdrum/.gem/ruby/3.1.2/gems/ruby-lsp-0.5.0/exe/ruby-lsp:21:in `<top (required)>'
from /Users/nirvdrum/.gem/ruby/3.1.2/bin/ruby-lsp:25:in `load'
from /Users/nirvdrum/.gem/ruby/3.1.2/bin/ruby-lsp:25:in `<top (required)>'
from /opt/rubies/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.15/lib/bundler/cli/exec.rb:58:in `load'
from /opt/rubies/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.15/lib/bundler/cli/exec.rb:58:in `kernel_load'
from /opt/rubies/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.15/lib/bundler/cli/exec.rb:23:in `run'
from /opt/rubies/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.15/lib/bundler/cli.rb:483:in `exec'
from /opt/rubies/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.15/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
from /opt/rubies/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.15/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
from /opt/rubies/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.15/lib/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
from /opt/rubies/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.15/lib/bundler/cli.rb:31:in `dispatch'
from /opt/rubies/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.15/lib/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
from /opt/rubies/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.15/lib/bundler/cli.rb:25:in `start'
from /opt/rubies/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.15/exe/bundle:48:in `block in <top (required)>'
from /opt/rubies/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.15/lib/bundler/friendly_errors.rb:117:in `with_friendly_errors'
from /opt/rubies/3.1.2/lib/ruby/gems/3.1.0/gems/bundler-2.3.15/exe/bundle:36:in `<top (required)>'
from /Users/nirvdrum/.gem/ruby/3.1.2/bin/bundle:25:in `load'
from /Users/nirvdrum/.gem/ruby/3.1.2/bin/bundle:25:in `<main>'
[Error - 11:06:45 AM] Server initialization failed.
Message: Pending response rejected since connection got disposed
Code: -32097
[Info - 11:06:45 AM] Connection to server got closed. Server will restart.
true
[Error - 11:06:45 AM] Ruby LSP client: couldn't create connection to server.
Message: Pending response rejected since connection got disposed
Code: -32097
Expected output
I haven't looked at the source at all, but it looks like the code in question is missing a require 'uri' somewhere.
Nevermind, I see this was fixed in #698. I searched the issue tracker for "undefined method 'uri'" but that didn't turn up anything. I didn't think to search PRs as well :-/
Ruby version
3.1.2
Code snippet
I'm not sure how to reproduce. I was presented with an error dialog from a VS Code window running in the background.
Description
I have the following in my "Ruby LSP" output section in VS Code. It's repeated many times but I've only pasted one cycle to keep the issue description smaller.
Expected output
I haven't looked at the source at all, but it looks like the code in question is missing a
require 'uri'
somewhere.