Skip to content

uninitialized constant RubyLsp::RuboCop::Cop (NameError) #3044

Description

@abrisse

Description

Ruby LSP Information

The version 1.17.0 of the gem rubocop defines a new module RubyLsp::Rubocop. (link) that breaks several lines of code of the gem ruby-lsp.

Reproduction steps

In my Gemfile.lock:

  • rubocop (1.70.0)
  • ruby-lsp (0.23.4)
  1. Start the Ruby LSP using VSCode
  2. It fails with the following message:
Errorprocessinginitialized: .bundle/ruby/3.1.0/gems/ruby-lsp-0.23.4/lib/ruby_lsp/requests/support/rubocop_runner.rb:86:in'initialize':uninitializedconstantRubyLsp::RuboCop::Cop(NameError)

Fix

Replace all the Rubocop references within the namespace RubyLsp using the top-level namespace operand :: That's already the case on some instructions but not everywhere.

So basically RuboCop::Cop should be replaced by ::RuboCop::Cop. I will try to provide a PR.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingvscodeThis 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