Shopify / ruby-lsp

An opinionated language server for Ruby
https://shopify.github.io/ruby-lsp/
MIT License
1.33k stars 118 forks source link

Error on goto defnition #1971

Closed tachyons closed 2 weeks ago

tachyons commented 3 weeks ago

Goto defnition is erroring out with following error

2024-04-25 17:25:31.292 [info] (gitlab) Error processing textDocument/definition: /Users/username/.asdf/installs/ruby/3.2.3/lib/ruby/gems/3.2.0/gems/uri-0.13.0/lib/uri/generic.rb:770:in `check_path': bad component(expected absolute path component): app/finders/crm/contacts_finder.rb (URI::InvalidComponentError)
    from /Users/username/.asdf/installs/ruby/3.2.3/lib/ruby/gems/3.2.0/gems/uri-0.13.0/lib/uri/generic.rb:816:in `path='
    from /Users/username/.asdf/installs/ruby/3.2.3/lib/ruby/gems/3.2.0/gems/uri-0.13.0/lib/uri/generic.rb:192:in `initialize'
    from /Users/username/.asdf/installs/ruby/3.2.3/lib/ruby/gems/3.2.0/gems/uri-0.13.0/lib/uri/generic.rb:136:in `new'
    from /Users/username/.asdf/installs/ruby/3.2.3/lib/ruby/gems/3.2.0/gems/uri-0.13.0/lib/uri/generic.rb:136:in `build'
    from /Users/username/.asdf/installs/ruby/3.2.3/lib/ruby/gems/3.2.0/gems/ruby-lsp-0.16.5/lib/core_ext/uri.rb:18:in `from_path'
    from /Users/username/.asdf/installs/ruby/3.2.3/lib/ruby/gems/3.2.0/gems/ruby-lsp-0.16.5/lib/ruby_lsp/listeners/definition.rb:88:in `block in handle_method_definition'
    from /Users/username/.asdf/installs/ruby/3.2.3/lib/ruby/gems/3.2.0/gems/ruby-lsp-0.16.5/lib/ruby_lsp/listeners/definition.rb:82:in `each'
    from /Users/username/.asdf/installs/ruby/3.2.3/lib/ruby/gems/3.2.0/gems/ruby-lsp-0.16.5/lib/ruby_lsp/listeners/definition.rb:82:in `handle_method_definition'
    from /Users/username/.asdf/installs/ruby/3.2.3/lib/ruby/gems/3.2.0/gems/ruby-lsp-0.16.5/lib/ruby_lsp/listeners/definition.rb:45:in `on_call_node_enter'
    from /Users/username/.asdf/installs/ruby/3.2.3/lib/ruby/gems/3.2.0/gems/prism-0.24.0/lib/prism/dispatcher.rb:1369:in `block in visit_call_node'
    from /Users/username/.asdf/installs/ruby/3.2.3/lib/ruby/gems/3.2.0/gems/prism-0.24.0/lib/prism/dispatcher.rb:1369:in `each'
    from /Users/username/.asdf/installs/ruby/3.2.3/lib/ruby/gems/3.2.0/gems/prism-0.24.0/lib/prism/dispatcher.rb:1369:in `visit_call_node'
    from /Users/username/.asdf/installs/ruby/3.2.3/lib/ruby/gems/3.2.0/gems/prism-0.24.0/lib/prism/node.rb:2493:in `accept'
    from /Users/username/.asdf/installs/ruby/3.2.3/lib/ruby/gems/3.2.0/gems/prism-0.24.0/lib/prism/dispatcher.rb:65:in `dispatch_once'
    from /Users/username/.asdf/installs/ruby/3.2.3/lib/ruby/gems/3.2.0/gems/ruby-lsp-0.16.5/lib/ruby_lsp/requests/definition.rb:79:in `perform'
    from /Users/username/.asdf/installs/ruby/3.2.3/lib/ruby/gems/3.2.0/gems/ruby-lsp-0.16.5/lib/ruby_lsp/server.rb:599:in `text_document_definition'
    from /Users/username/.asdf/installs/ruby/3.2.3/lib/ruby/gems/3.2.0/gems/ruby-lsp-0.16.5/lib/ruby_lsp/server.rb:70:in `process_message'
    from /Users/username/.asdf/installs/ruby/3.2.3/lib/ruby/gems/3.2.0/gems/ruby-lsp-0.16.5/lib/ruby_lsp/base_server.rb:128:in `block in new_worker'

2024-04-25 17:25:31.293 [info] (gitlab) [Error - 17:25:31] Request textDocument/definition failed.
2024-04-25 17:25:31.293 [info] (gitlab) TypeError: Cannot read properties of null (reading 'errorClass')
    at ws.benchmarkMiddleware (/Users/username/.vscode/extensions/shopify.ruby-lsp-0.5.19/out/extension.js:44:64379)
    at async h.provideDefinition (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:150:95765)

Ruby lsp version: 0.16.5

andyw8 commented 3 weeks ago

Thank you for the report. This seems to relate to the new functionality added in https://github.com/Shopify/ruby-lsp/pull/1961.

andyw8 commented 3 weeks ago

FYI @st0012