Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ruby LSP indexing fails with undefined method required_positionals #2630

Closed
jmschp opened this issue Sep 30, 2024 · 7 comments · Fixed by #2631
Closed

Ruby LSP indexing fails with undefined method required_positionals #2630

jmschp opened this issue Sep 30, 2024 · 7 comments · Fixed by #2631
Assignees
Labels
bug Something isn't working vscode This pull request should be included in the VS Code extension's release notes

Comments

@jmschp
Copy link

jmschp commented Sep 30, 2024

Description

Ruby LSP Information

Ruby LSP Information

VS Code Version

1.93.1

Ruby LSP Extension Version

0.8.1

Ruby LSP Server Version

0.18.3

Ruby LSP Addons

Ruby Version

3.3.5

Ruby Version Manager

asdf

Installed Extensions

Click to expand
  • better-comments (3.0.2)
  • cucumberautocomplete (3.0.5)
  • vscode-erb-beautify (0.5.0)
  • vscode-markdownlint (0.56.0)
  • vscode-eslint (3.0.10)
  • dotenv-vscode (0.28.1)
  • gitlens (15.5.1)
  • prettier-vscode (11.0.0)
  • vscode-pull-request-github (0.96.0)
  • todo-tree (0.0.226)
  • vscode-drawio (1.6.6)
  • prettier-sql-vscode (1.6.0)
  • haml (1.4.1)
  • mongodb-vscode (1.8.1)
  • vscode-docker (1.29.3)
  • vscode-dotnet-runtime (2.1.6)
  • debugpy (2024.10.0)
  • python (2024.14.1)
  • vscode-pylance (2024.9.2)
  • cpptools (1.21.6)
  • cpptools-extension-pack (1.3.0)
  • cpptools-themes (2.0.0)
  • vscode-versionlens (1.14.2)
  • material-icon-theme (5.11.1)
  • platformio-ide (3.3.3)
  • vscode-xml (0.27.1)
  • vscode-yaml (1.15.0)
  • trailing-spaces (0.4.1)
  • ruby-lsp (0.8.1)
  • code-spell-checker (4.0.13)
  • code-spell-checker-portuguese-brazilian (2.2.1)
  • vscode-stripe (3.2.6)
  • vscode-stylelint (1.4.0)
  • highlight-matching-tag (0.11.0)
  • markdown-all-in-one (3.6.2)

Ruby LSP Settings

Click to expand
Workspace
{}
User
{
  "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": "asdf"
  },
  "customRubyCommand": "",
  "formatter": "auto",
  "linters": null,
  "bundleGemfile": "",
  "testTimeout": 30,
  "branch": "",
  "pullDiagnosticsOn": "both",
  "useBundlerCompose": false,
  "bypassTypechecker": false,
  "rubyExecutablePath": "",
  "indexing": {},
  "erbSupport": true
}

Reproduction steps

  1. Start the Ruby LSP using VS Code
  2. Open a folder containing a Ruby file and a Gemfile specifing only rubocop
  3. Indexing starts and fails immediately
  4. See unexpected behavior

Code snippet or error message

Error while indexing: undefined method `required_positionals' for an instance of RBS::Types::UntypedFunction

I have tried in different Rails projects and I have the same behavior.

In an older Rails project running ruby 3.0.4, I get the following error:

Error while indexing: undefined method `required_positionals' for #<RBS::Types::UntypedFunction:0x000000012d923438 @return_type=#<RBS::Types::Bases::Any:0x000000012d923488 @location=#<RBS::Location:15920 buffer=/Users/jmschp/.asdf/installs/ruby/3.0.4/lib/ruby/gems/3.0.0/gems/rbs-3.6.0/core/method.rbs, start=138:19, pos=4835...4842, children= source="untyped">>>
@jmschp jmschp added bug Something isn't working vscode This pull request should be included in the VS Code extension's release notes labels Sep 30, 2024
@jmschp jmschp changed the title Ruby LSP indexing fails with undefined method `required_positionals Ruby LSP indexing fails with undefined method required_positionals Sep 30, 2024
@IlyaUmanets
Copy link

I see the same issue

@herko
Copy link

herko commented Sep 30, 2024

Same here. Using zed editor.

@thomasklemm
Copy link

Same here: Error while indexing: undefined method required_positionals' for an instance of RBS::Types::UntypedFunction`

@srpouyet
Copy link

It seems like indexing broke with today's release of version 3.6.0 of rbs. When pinning rbs to version 3.5.3 indexing works fine.

@vinistock
Copy link
Member

Thank you for the bug report!

This PR should fix this #2631.

@andyw8
Copy link
Contributor

andyw8 commented Sep 30, 2024

We've released the fix in v0.18.4. To update, follow the steps here:
https://shopify.github.io/ruby-lsp/troubleshooting.html#outdated-version

@MattyMc
Copy link

MattyMc commented Sep 30, 2024

Thank you @vinistock and @andyw8 ! Forcing up to v0.18.4 with this command from the docs fixed it for me:

BUNDLE_GEMFILE=.ruby-lsp/Gemfile bundle update ruby-lsp

Earlopain added a commit to Earlopain/good_job that referenced this issue Oct 10, 2024
Dependabot does not do this because it resolves with Ruby 3.0 from the gemspec
and tapioca now only supports 3.1

This unblocks prism 1.0 which is required for the ruby-lsp to update to the latest version.
Currently it runs into Shopify/ruby-lsp#2630, causing a restart loop.

To make sure this does the right thing on older rubies, I added a step to print the resolved lockfile on CI
bensheldon pushed a commit to bensheldon/good_job that referenced this issue Oct 10, 2024
Dependabot does not do this because it resolves with Ruby 3.0 from the gemspec
and tapioca now only supports 3.1

This unblocks prism 1.0 which is required for the ruby-lsp to update to the latest version.
Currently it runs into Shopify/ruby-lsp#2630, causing a restart loop.

To make sure this does the right thing on older rubies, I added a step to print the resolved lockfile on CI
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working vscode This pull request should be included in the VS Code extension's release notes
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants