Shopify / ruby-lsp

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

Go to definition does not work: Error while indexing: undefined method `required_positionals' for #<RBS::Types::UntypedFunction #2776

Closed fabioxgn closed 2 weeks ago

fabioxgn commented 2 weeks ago

Description

Go to definition always worked on my vscode and it stopped for some time now, I also see the error below in a popup every time a open the project.

Ruby LSP Information

VS Code Version

1.94.2

Ruby LSP Extension Version

0.8.8

Ruby LSP Server Version

0.17.16

Ruby LSP Addons

Ruby Version

3.2.3

Ruby Version Manager

asdf

Installed Extensions

Click to expand - gitlens (15.6.2) - EditorConfig (0.16.4) - prettier-vscode (11.0.0) - copilot (1.242.0) - copilot-chat (0.21.2) - vscode-edit-csv (0.10.0) - haml (1.4.1) - vscode-rdbg (0.2.2) - rainbow-csv (3.12.0) - vscode-duplicate (1.2.1) - vscode-kubernetes-tools (1.3.18) - black-formatter (2024.4.0) - debugpy (2024.12.0) - python (2024.16.1) - vscode-pylance (2024.10.1) - javascript-test-runner (0.2.0) - vscode-yaml (1.15.0) - ruby-extensions-pack (0.1.12) - ruby-lsp (0.8.8) - sorbet-vscode-extension (0.3.37)

Ruby LSP Settings

Click to expand ##### Workspace ```json { "indexing": { "excludedPatterns": [ "**/spec/**/*.rb" ] } } ``` ##### User ```json { "enableExperimentalFeatures": false, "enabledFeatures": { "codeActions": true, "diagnostics": true, "documentHighlights": true, "documentLink": true, "documentSymbols": true, "foldingRanges": true, "formatting": true, "hover": true, "inlayHint": true, "onTypeFormatting": true, "selectionRanges": true, "semanticHighlighting": true, "completion": true, "codeLens": true, "definition": true, "workspaceSymbol": true, "signatureHelp": true, "typeHierarchy": true }, "featuresConfiguration": {}, "addonSettings": {}, "rubyVersionManager": { "identifier": "auto" }, "customRubyCommand": "", "formatter": "auto", "linters": null, "bundleGemfile": "", "testTimeout": 30, "branch": "", "pullDiagnosticsOn": "both", "useBundlerCompose": false, "bypassTypechecker": false, "rubyExecutablePath": "", "indexing": { "excludedPatterns": [ "**/spec/**/*.rb" ] }, "erbSupport": true } ```

Reproduction steps

  1. Start the Ruby LSP using csv
  2. Open a Ruby file
  3. A popup shows the error below
  4. Try to use "Go to definition" to a simple thing like the User model
  5. Go to definition doesn't work "No definition found for 'User"

Code snippet or error message

Error while indexing: undefined method `required_positionals' for #<RBS::Types::UntypedFunction:0x0000000118984e78 @return_type=#<RBS::Types::Bases::Any:0x0000000118984ec8 @location=#<RBS::Location:21340 buffer=/Users/fabiogomes/.asdf/installs/ruby/3.2.3/lib/ruby/gems/3.2.0/gems/rbs-3.6.1/core/method.rbs, start=138:19, pos=4835...4842, children= source="untyped">>>
andyw8 commented 2 weeks ago

This is a duplicate of https://github.com/Shopify/ruby-lsp/issues/2630. You're using an outdated version of the Ruby LSP server (gem).

andyw8 commented 2 weeks ago

(some other dependency in your project may be constraining the Ruby LSP version, which would be why you've only started seeing this).

vinistock commented 2 weeks ago

Thank you for the report! As Andy mentioned this problem has already been fixed in v0.18.4, so it's likely that the ruby-lsp gem is failing to update for some reason.

There are some instructions and more context here.

Please let us know if you hit any issues while upgrading it.

fabioxgn commented 2 weeks ago

Thank you for the report! As Andy mentioned this problem has already been fixed in v0.18.4, so it's likely that the ruby-lsp gem is failing to update for some reason.

There are some instructions and more context here.

Please let us know if you hit any issues while upgrading it.

Thank you! Updating solved the issue!