Skip to content

Ruby LSP formatter is set to rubocop but RuboCop was not found in the Gemfile or gemspec. #2564

Closed as not planned

Description

Description

Ruby LSP and Rubocop assist does not work.

Ruby LSP Information

VS Code Version

1.93.1

Ruby LSP Extension Version

0.7.20

Ruby LSP Server Version

0.17.17

Ruby LSP Addons

  • Ruby LSP Rails

Ruby Version

3.2.4

Ruby Version Manager

none

Installed Extensions

Click to expand
  • gitlens (15.5.1)
  • copilot (1.229.0)
  • copilot-chat (0.20.1)
  • vscode-rdbg (0.2.2)
  • ruby-extensions-pack (0.1.11)
  • ruby-lsp (0.7.20)

Ruby LSP Settings

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

Reproduction steps

  1. Start VS Code
  2. Open in container

Then show following alert messages.

Ruby LSP formatter is set to `rubocop` but RuboCop was not found in the Gemfile or gemspec.
Source: Ruby LSP
Error loading addons: Ruby LSP Rails: wrong number of arguments (given 2, expected 1)
Source: Ruby LSP

I have rubocop in the workspace.

$ bundle exec rubocop --version
1.56.4

Output Ruby LSP tab

2024-09-18 17:19:34.591 [info] (workspace) Running command: `ruby -W0 -rjson -e 'STDERR.print({ env: ENV.to_h, yjit: !!defined?(RubyVM::YJIT), version: RUBY_VERSION }.to_json)'` in /workspace using shell: /bin/bash
2024-09-18 17:19:35.508 [info] (workspace) Initializing Ruby LSP v0.17.17...
2024-09-18 17:19:35.543 [info] (workspace) Auto detected formatter: rubocop
2024-09-18 17:19:35.543 [info] (workspace) Auto detected linters: rubocop
2024-09-18 17:19:35.543 [info] (workspace) Detected test library: rspec
2024-09-18 17:19:35.543 [info] (workspace) Finished initializing Ruby LSP!
2024-09-18 17:19:35.564 [info] (workspace) /bundle/ruby/3.2.0/gems/ruby-lsp-rails-0.3.3/lib/ruby_lsp/ruby_lsp_rails/addon.rb:27:in `activate': wrong number of arguments (given 2, expected 1) (ArgumentError)
	from /bundle/gems/sorbet-runtime-0.5.11292/lib/types/private/methods/_methods.rb:279:in `bind_call'
	from /bundle/gems/sorbet-runtime-0.5.11292/lib/types/private/methods/_methods.rb:279:in `block in _on_method_added'
	from /bundle/gems/ruby-lsp-0.17.17/lib/ruby_lsp/addon.rb:75:in `block in load_addons'
	from /bundle/gems/ruby-lsp-0.17.17/lib/ruby_lsp/addon.rb:74:in `each'
	from /bundle/gems/ruby-lsp-0.17.17/lib/ruby_lsp/addon.rb:74:in `load_addons'
	from /bundle/gems/ruby-lsp-0.17.17/lib/ruby_lsp/server.rb:132:in `load_addons'
	from /bundle/gems/ruby-lsp-0.17.17/lib/ruby_lsp/server.rb:283:in `run_initialized'
	from /bundle/gems/ruby-lsp-0.17.17/lib/ruby_lsp/server.rb:27:in `process_message'
	from /bundle/gems/ruby-lsp-0.17.17/lib/ruby_lsp/base_server.rb:66:in `block in start'
	from /bundle/gems/language_server-protocol-3.17.0.3/lib/language_server/protocol/transport/io/reader.rb:20:in `read'
	from /bundle/gems/ruby-lsp-0.17.17/lib/ruby_lsp/base_server.rb:39:in `start'
	from /bundle/gems/ruby-lsp-0.17.17/exe/ruby-lsp:138:in `<top (required)>'
	from /bundle/bin/ruby-lsp:25:in `load'
	from /bundle/bin/ruby-lsp:25:in `<main>'

When open Ruby file, then appear in Output Window tab.

2024-09-18 17:22:02.718 [error] /bundle/ruby/3.2.0/gems/ruby-lsp-rails-0.3.3/lib/ruby_lsp/ruby_lsp_rails/addon.rb:57:in `create_hover_listener': wrong number of arguments (given 3, expected 4) (ArgumentError)
	from /bundle/gems/sorbet-runtime-0.5.11292/lib/types/private/methods/_methods.rb:279:in `bind_call'
	from /bundle/gems/sorbet-runtime-0.5.11292/lib/types/private/methods/_methods.rb:279:in `block in _on_method_added'
	from /bundle/gems/ruby-lsp-0.17.17/lib/ruby_lsp/requests/hover.rb:70:in `block in initialize'
	from /bundle/gems/ruby-lsp-0.17.17/lib/ruby_lsp/requests/hover.rb:69:in `each'
	from /bundle/gems/ruby-lsp-0.17.17/lib/ruby_lsp/requests/hover.rb:69:in `initialize'
	from /bundle/gems/sorbet-runtime-0.5.11292/lib/types/private/methods/_methods.rb:279:in `bind_call'
	from /bundle/gems/sorbet-runtime-0.5.11292/lib/types/private/methods/_methods.rb:279:in `block in _on_method_added'
	from /bundle/gems/sorbet-runtime-0.5.11292/lib/types/private/abstract/declare.rb:37:in `new'
	from /bundle/gems/sorbet-runtime-0.5.11292/lib/types/private/abstract/declare.rb:37:in `block in declare_abstract'
	from /bundle/gems/ruby-lsp-0.17.17/lib/ruby_lsp/server.rb:588:in `text_document_hover'
	from /bundle/gems/ruby-lsp-0.17.17/lib/ruby_lsp/server.rb:57:in `process_message'
	from /bundle/gems/ruby-lsp-0.17.17/lib/ruby_lsp/base_server.rb:128:in `block in new_worker'
: Error: /bundle/ruby/3.2.0/gems/ruby-lsp-rails-0.3.3/lib/ruby_lsp/ruby_lsp_rails/addon.rb:57:in `create_hover_listener': wrong number of arguments (given 3, expected 4) (ArgumentError)
	from /bundle/gems/sorbet-runtime-0.5.11292/lib/types/private/methods/_methods.rb:279:in `bind_call'
	from /bundle/gems/sorbet-runtime-0.5.11292/lib/types/private/methods/_methods.rb:279:in `block in _on_method_added'
	from /bundle/gems/ruby-lsp-0.17.17/lib/ruby_lsp/requests/hover.rb:70:in `block in initialize'
	from /bundle/gems/ruby-lsp-0.17.17/lib/ruby_lsp/requests/hover.rb:69:in `each'
	from /bundle/gems/ruby-lsp-0.17.17/lib/ruby_lsp/requests/hover.rb:69:in `initialize'
	from /bundle/gems/sorbet-runtime-0.5.11292/lib/types/private/methods/_methods.rb:279:in `bind_call'
	from /bundle/gems/sorbet-runtime-0.5.11292/lib/types/private/methods/_methods.rb:279:in `block in _on_method_added'
	from /bundle/gems/sorbet-runtime-0.5.11292/lib/types/private/abstract/declare.rb:37:in `new'
	from /bundle/gems/sorbet-runtime-0.5.11292/lib/types/private/abstract/declare.rb:37:in `block in declare_abstract'
	from /bundle/gems/ruby-lsp-0.17.17/lib/ruby_lsp/server.rb:588:in `text_document_hover'
	from /bundle/gems/ruby-lsp-0.17.17/lib/ruby_lsp/server.rb:57:in `process_message'
	from /bundle/gems/ruby-lsp-0.17.17/lib/ruby_lsp/base_server.rb:128:in `block in new_worker'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    vscodeThis pull request should be included in the VS Code extension's release notes

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions