bugfix: Initialize definitionIndexStrategy when initializing - #8352
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThe definition index strategy now comes from initialization options or feature flags through ChangesDefinition index strategy
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant Client
participant ClientConfiguration
participant FeatureFlagProvider
participant Indexer
Client->>ClientConfiguration: send initialization options
ClientConfiguration->>FeatureFlagProvider: resolve fallback strategy
FeatureFlagProvider-->>ClientConfiguration: return strategy
ClientConfiguration->>Indexer: provide definitionIndexStrategy()
Indexer->>Indexer: apply strategy to dependency indexing
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Added scalameta/metals-vscode#1947 to show how this would work. I want to gather up all the similar options together as they heavily influence the performance and behaviour |
b64ad7c to
60114e7
Compare
60114e7 to
52624ed
Compare
There was a problem hiding this comment.
🧹 Nitpick comments (1)
metals/src/main/scala/scala/meta/internal/metals/UserConfiguration.scala (1)
1360-1366: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueRename
ProtoOutlineProviderConfig.fromConfigOrFeatureFlagnow that it no longer uses feature flags.The method name
fromConfigOrFeatureFlagstill implies feature-flag resolution, but the signature in Configs.scala no longer accepts aFeatureFlagProviderand theNonecase only returnsProtoOutlineProviderConfig.default. Every otherfromConfigOrFeatureFlagsibling method (WorkspaceSymbolProviderConfig,DefinitionProviderConfig,ReferenceProviderConfig, and so on) still resolves a feature flag in theNonecase, so this method now breaks that naming convention. Rename it tofromConfigfor clarity.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@metals/src/main/scala/scala/meta/internal/metals/UserConfiguration.scala` around lines 1360 - 1366, Rename ProtoOutlineProviderConfig.fromConfigOrFeatureFlag to fromConfig in its definition and update the invocation inside UserConfiguration’s protoOutlineProvider initialization; preserve the existing parsing and default behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@metals/src/main/scala/scala/meta/internal/metals/UserConfiguration.scala`:
- Around line 1360-1366: Rename
ProtoOutlineProviderConfig.fromConfigOrFeatureFlag to fromConfig in its
definition and update the invocation inside UserConfiguration’s
protoOutlineProvider initialization; preserve the existing parsing and default
behavior.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 34b47472-a0e5-438d-92df-bc1a0bdd99e6
📒 Files selected for processing (13)
metals-mcp/src/main/scala/scala/meta/internal/metals/mcp/StandaloneMcpService.scalametals-mcp/src/main/scala/scala/meta/metals/McpMain.scalametals/src/main/scala/scala/meta/internal/metals/ClientConfiguration.scalametals/src/main/scala/scala/meta/internal/metals/Configs.scalametals/src/main/scala/scala/meta/internal/metals/Indexer.scalametals/src/main/scala/scala/meta/internal/metals/InitializationOptions.scalametals/src/main/scala/scala/meta/internal/metals/MetalsLspService.scalametals/src/main/scala/scala/meta/internal/metals/UserConfiguration.scalametals/src/main/scala/scala/meta/internal/metals/WorkspaceLspService.scalatests/unit/src/main/scala/tests/BaseLspSuite.scalatests/unit/src/test/scala/tests/CompletionLspSuite.scalatests/unit/src/test/scala/tests/ManualSuite.scalatests/unit/src/test/scala/tests/UserConfigurationSuite.scala
💤 Files with no reviewable changes (2)
- tests/unit/src/main/scala/tests/BaseLspSuite.scala
- tests/unit/src/test/scala/tests/ManualSuite.scala
Previously, we would do it after initialized at which point the indexing has already happened. Now, we index according to the strategy the user wants. The other option is to handle the change, but if someone uses non default, they will always get double indexing.
52624ed to
a1d2078
Compare
Previously, we would do it after initialized at which point the indexing has already happened. Now, we index according to the strategy the user wants.
The other option is to handle the change, but if someone uses non default, they will always get double indexing.
CC @olafurpg though it doesn't really change anything for feature flags.
A side note is that I realized that even though the classpath indexing is faster it will miss features such as type member completions etc. This can easily be chosen by the user, for larger codebase they could turn on classpath, but for smaller keeup using sources.
Summary by CodeRabbit
New Features
Improvements