KEMBAR78
Fix the built-in Ruby LSP add-on not restarting when config files change by Earlopain · Pull Request #14507 · rubocop/rubocop · GitHub
Skip to content

Conversation

@Earlopain
Copy link
Contributor

I did not actually verify #14506 by making changes to a todo.

Since the adapter is given over to ruby-lsp, simply overwriting the instance variable doesn't do anything.

I've adapted tests to check for the presence of the reload log message, and added one that actually goes through and checks config changes in detail.


Before submitting the PR make sure the following are checked:

  • The PR relates to only one subject with a clear title and description in grammatically correct, complete sentences.
  • Wrote good commit messages.
  • Commit message starts with [Fix #issue-number] (if the related issue exists).
  • Feature branch is up-to-date with master (if not - rebase it).
  • Squashed related commits together.
  • Added tests.
  • Ran bundle exec rake default. It executes all tests and runs RuboCop on its own code.
  • Added an entry (file) to the changelog folder named {change_type}_{change_description}.md if the new code introduces user-observable changes. See changelog entry format for details.

@Earlopain Earlopain force-pushed the ruby-lsp-config-reload branch from 5c32430 to 4841ce2 Compare September 4, 2025 16:50
RESTART_WATCHERS = %w[.rubocop.yml .rubocop_todo.yml].freeze

def initializer
def initialize
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo. It doesn't affect anything but it took me embarrassingly long to notice this while debugging, so I fixed it.

…rubocop.yml`, `.rubocop_todo.yml`) change

I did not actually verify rubocop#14506 by making changes to a todo.

Since the adapter is given over to ruby-lsp, simply overwriting the instance variable doesn't do anything.

I've adapted tests to check for the presence of the reload log message,
and added one that actually goes through and checks config changes in detail.
@Earlopain Earlopain force-pushed the ruby-lsp-config-reload branch from 4841ce2 to 1fea9da Compare September 4, 2025 17:02

before do
# Suppress Ruby LSP's add-on logging.
allow(RuboCop::LSP::Logger).to receive(:log)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is inside mock console output, so not needed. Removing it allows me to assert against some other log messages in later tests

@koic koic merged commit 1d45fac into rubocop:master Sep 5, 2025
22 checks passed
@Earlopain Earlopain deleted the ruby-lsp-config-reload branch September 5, 2025 02:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants