You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I just encountered a somewhat strange issue. I am trying to use Ruby LSP, but it crashes during initialization:
Ruby LSP> Skipping lockfile copies because there's no top level bundle
Ruby LSP> Running bundle install for the custom bundle. This may take a while...
Could not find gem 'debug'.
C:/Ruby32-x64/lib/ruby/3.2.0/uri/generic.rb:770:in `check_path': bad component(expected absolute path component): c:/Users/w4rh4wk/git/ank (URI::InvalidComponentError)
from C:/Ruby32-x64/lib/ruby/3.2.0/uri/generic.rb:816:in `path='
from C:/Ruby32-x64/lib/ruby/3.2.0/uri/generic.rb:192:in `initialize'
from C:/Ruby32-x64/lib/ruby/3.2.0/uri/generic.rb:136:in `new'
from C:/Ruby32-x64/lib/ruby/3.2.0/uri/generic.rb:136:in `build'
from C:/Users/w4rh4wk/.gem/ruby/3.2.0/gems/ruby-lsp-0.8.0/lib/core_ext/uri.rb:18:in `from_path'
from C:/Users/w4rh4wk/.gem/ruby/3.2.0/gems/sorbet-runtime-0.5.10965/lib/types/private/methods/_methods.rb:277:in `bind_call'
from C:/Users/w4rh4wk/.gem/ruby/3.2.0/gems/sorbet-runtime-0.5.10965/lib/types/private/methods/_methods.rb:277:in `block in _on_method_added'
from C:/Users/w4rh4wk/.gem/ruby/3.2.0/gems/ruby-lsp-0.8.0/lib/ruby_lsp/utils.rb:9:in `<module:RubyLsp>'
from C:/Users/w4rh4wk/.gem/ruby/3.2.0/gems/ruby-lsp-0.8.0/lib/ruby_lsp/utils.rb:4:in `<top (required)>'
from <internal:C:/Ruby32-x64/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:37:in `require'
from <internal:C:/Ruby32-x64/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:37:in `require'
from C:/Users/w4rh4wk/.gem/ruby/3.2.0/gems/ruby-lsp-0.8.0/lib/ruby_lsp/internal.rb:14:in `<top (required)>'
from C:/Users/w4rh4wk/.gem/ruby/3.2.0/gems/ruby-lsp-0.8.0/exe/ruby-lsp:39:in `require_relative'
from C:/Users/w4rh4wk/.gem/ruby/3.2.0/gems/ruby-lsp-0.8.0/exe/ruby-lsp:39:in `<top (required)>'
from C:/Users/w4rh4wk/AppData/Local/Microsoft/WindowsApps/ruby-lsp:32:in `load'
from C:/Users/w4rh4wk/AppData/Local/Microsoft/WindowsApps/ruby-lsp:32:in `<main>'
[Error - 10:41:05 PM] Server initialization failed.
Message: Pending response rejected since connection got disposed
Code: -32097
It appears that the path c:/Users/w4rh4wk/git/ank is not considered a valid absolute path. Inspecting the code around this invocation shows this:
deffrom_path(path:,scheme: "file")# On Windows, if the path begins with the disk name, we need to add a leading slash to make it a valid URIescaped_path=if/^[A-Z]:/.match?(path)DEFAULT_PARSER.escape("/#{path}")elseDEFAULT_PARSER.escape(path)endbuild(scheme: scheme,path: escaped_path)end
Since the regex matches only on uppercase drive letters, no leading slash is added.
I have no idea why the drive letter in this path is lowercase. My suggestion would be to also add support for lowercase drive letters to the regex.
Expected output
Ruby LSP should not crash during initialization.
The text was updated successfully, but these errors were encountered:
Ruby version
3.2.2
Code snippet
No response
Description
I just encountered a somewhat strange issue. I am trying to use Ruby LSP, but it crashes during initialization:
It appears that the path
c:/Users/w4rh4wk/git/ank
is not considered a valid absolute path. Inspecting the code around this invocation shows this:Since the regex matches only on uppercase drive letters, no leading slash is added.
I have no idea why the drive letter in this path is lowercase. My suggestion would be to also add support for lowercase drive letters to the regex.
Expected output
Ruby LSP should not crash during initialization.
The text was updated successfully, but these errors were encountered: