vscode on save got incredibly slow after rubocop 1.90 upgrade + UseProjectIndex
Nobody has claimed this yet.
- Dominant language
- Ruby
- Stars
- 2k
- Forks
- 281
- Avg merge
- 2h 14m
- Merged PRs (30d)
- 6
Description
Description
Ruby LSP Information
### Ruby LSP Information
#### VS Code Version
1.137.0
#### Ruby LSP Extension Version
0.10.6
#### Ruby LSP Server Version
0.26.11
#### Ruby LSP Add-ons
- Tapioca (0.1.3)
- Ruby LSP Rails (0.4.8)
- RuboCop (1.90.0)
#### Ruby Version
4.0.6
#### Ruby Version Manager
asdf
#### Installed Extensions
<details>
<summary>Click to expand</summary>
- claude-code (2.1.270)
- remote-containers (0.469.0)
- ruby-extensions-pack (0.1.14)
- ruby-lsp (0.10.6)
- sorbet-vscode-extension (0.3.47)
- terraform (0.2.5)
- vim (1.32.4)
- vscode-containers (2.5.0)
- vscode-jsonnet (0.7.4)
</details>
#### Ruby LSP Settings
<details>
<summary>Click to expand</summary>
##### Workspace
```json
{
"indexing": {
"excluded_patterns": [
"/bin/**",
"/cypress/**",
"/front-end/**",
"/kubernetes/**",
"/public/**",
"/secrets/**",
"/semgrep/**"
],
"excluded_gems": [
"annotate",
"better_errors",
"binding_of_caller",
"brakeman",
"bullet",
"bundler_audit",
"danger",
"danger-rubocop",
"debase",
"guard",
"guard-rspec",
"knapsack_pro",
"listen",
"parallel_tests",
"rspec_junit_formatter",
"rubocop",
"rubocop-daemon",
"rubocop-rails",
"rubocop-rspec",
"ruby-debug-ide",
"ruby-lsp",
"solargraph",
"spring-commands-rpsec",
"squasher",
"super_diff"
]
}
}
User
{
"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": "auto"
},
"customRubyCommand": "",
"formatter": "auto",
"linters": null,
"bundleGemfile": "",
"testTimeout": 30,
"pullDiagnosticsOn": "both",
"useBundlerCompose": false,
"bypassTypechecker": false,
"rubyExecutablePath": "",
"indexing": {
"excluded_patterns": [
"/bin/**",
"/cypress/**",
"/front-end/**",
"/kubernetes/**",
"/public/**",
"/secrets/**",
"/semgrep/**"
],
"excluded_gems": [
"annotate",
"better_errors",
"binding_of_caller",
"brakeman",
"bullet",
"bundler_audit",
"danger",
"danger-rubocop",
"debase",
"guard",
"guard-rspec",
"knapsack_pro",
"listen",
"parallel_tests",
"rspec_junit_formatter",
"rubocop",
"rubocop-daemon",
"rubocop-rails",
"rubocop-rspec",
"ruby-debug-ide",
"ruby-lsp",
"solargraph",
"spring-commands-rpsec",
"squasher",
"super_diff"
]
},
"erbSupport": true,
"featureFlags": {},
"sigOpacityLevel": "1"
}
```
Reproduction steps
The reproduction is hard without a sufficiently large app. As mentioned above, after upgrading to rubocop 1.90, and enabling the UseProjectIndex config, which enables their rubydex integration, rubocop-on-save suddenly started taking >30s, up to the point where I'm constantly pressing "Skip" when running the rubocop formatter.
My understanding is that ruby-lsp's rubocop integration just runs rubocop cli command on save. My guess, and based on what's written here, is that when the integration is enabled, rubocop will reindex the whole project before running cops.
This may not be a ruby-lsp problem, but it does result in visible DX impact for ruby-lsp users, which will perceive the tool as being slow. This being an experimental flag, the goal is to document this, so that the integration can be reworked so that rubocop's add-on piggy backs on ruby-lsp's already indexed workspace and skips this step.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the Ruby LSP RuboCop-on-save integration and its RuboCop CLI invocation, then compare behavior with RuboCop 1.90's UseProjectIndex and rubydex documentation. Done means the reindexing slowdown is reproduced or bounded and the integration documents or avoids redundant project indexing; no file or test is named.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ruby, vscode
- Domain
- developer-experience, performance, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100