Skip to content

Reuse the Ruby LSP index in RuboCop - #4287

Open
efegokdemir wants to merge 1 commit into
Shopify:rubydex_adoption_feature_branchfrom
efegokdemir:efe/ruby-lsp-rubocop-project-index-4208
Open

efegokdemir wants to merge 1 commit into
Shopify:rubydex_adoption_feature_branchfrom
efegokdemir:efe/ruby-lsp-rubocop-project-index-4208

Conversation

@efegokdemir

Copy link
Copy Markdown

Motivation

Closes #4208. With UseProjectIndex enabled, RuboCop rebuilds its project index for each request, adding avoidable work during on-save linting.

Implementation

Reuse Ruby LSP's current Rubydex graph when the RuboCop project root matches the workspace root. Keep RuboCop's own index path when gem sources are included or the configuration does not opt in.

Automated Tests

  • Runner regression tests: 4 runs, 4 assertions.
  • Formatting tests: 12 runs, 13 assertions.
  • RuboCop and Sorbet passed; git diff --check passed.
  • A RuboCop 1.90 smoke check confirmed reuse of the shared graph, including macOS /var and /private/var paths.
  • Server tests: 49/50 passed. test_backtrace_is_printed_to_stderr_on_exceptions failed because its expected stack path contains ruby-lsp/lib, which is absent from this checkout path.

Manual Tests

Not run in VS Code.

@efegokdemir
efegokdemir requested a review from a team as a code owner November 26, 2026 09:04

This branch has not been deployed

No deployments
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.

1 participant