fix: inconsistent search scope in source modules and project structure provider#1361
fix: inconsistent search scope in source modules and project structure provider#1361itsaky-adfa wants to merge 2 commits into
Conversation
…e provider Signed-off-by: Akash Yadav <akashyadav@appdevforall.org> # Conflicts: # app/src/main/java/com/itsaky/androidide/app/IDEApplication.kt
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughRelease Notes
Risks and best-practice concerns
WalkthroughThis PR extracts a reusable AbstractCompilationEnvironment, introduces provider-based analysis service registration, refactors source-module scope discovery, improves index overridability and prefix matching, skips local declarations during source indexing, and adds JVM test fixtures and regression tests. ChangesKotlin Compilation Environment Refactoring
Module System and Source File Discovery
Index System Improvements
Test Infrastructure and Fixtures
Supporting and Cleanup Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 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 |
There was a problem hiding this comment.
Actionable comments posted: 3
🧹 Nitpick comments (1)
lsp/kotlin/src/test/java/com/itsaky/androidide/lsp/kotlin/fixtures/KtLspTestRule.kt (1)
30-33: 💤 Low valueThe
env.project.write { }block is currently a no-op.With
env.close()commented out, the write block does nothing andenvis never disposed, leaving its resources held for the duration of the suite. This is acknowledged via the TODO, but worth resolving so the environment is torn down between tests.Want me to open an issue to track teardown of
env(investigating whyenv.close()fails under test), or draft a working disposal sequence?🤖 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 `@lsp/kotlin/src/test/java/com/itsaky/androidide/lsp/kotlin/fixtures/KtLspTestRule.kt` around lines 30 - 33, The env.project.write { } block is a no-op because env.close() is commented out, so ensure the test environment is reliably torn down by calling env.close() from the rule's teardown rather than leaving it inside the write block: move the disposal into a proper tearDown/after method in KtLspTestRule, call env.close() (or Disposer.dispose(env) if close() is unstable) inside a try/catch to swallow/log any exceptions, and null out the env reference after successful disposal so resources are released between tests; reference env, env.close(), env.project.write { }, and the KtLspTestRule teardown method when applying the change.
🤖 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.
Inline comments:
In
`@lsp/kotlin/src/main/java/com/itsaky/androidide/lsp/kotlin/compiler/modules/AbstractSourceModule.kt`:
- Around line 10-28: The file uses kotlin.io.path.walk which is marked
experimental; add an opt-in for ExperimentalPathApi at the top of the file
(file-level) so the compiler allows use of kotlin.io.path.walk (or alternatively
enable -Xopt-in=kotlin.io.path.ExperimentalPathApi for the module); update
AbstractSourceModule (where computeFiles calls walk) to have
`@OptIn`(kotlin.io.path.ExperimentalPathApi::class) applied file-wide to suppress
the experimental API error.
In
`@lsp/kotlin/src/test/java/com/itsaky/androidide/lsp/kotlin/fixtures/KtLspTestRule.kt`:
- Around line 28-35: The TemporaryFolder created as tempDir is manually created
(tempDir.create()) and not registered as a JUnit rule, so its cleanup never
runs; update the teardown in the finally block of KtLspTestRule to explicitly
delete the tempDir (call tempDir.delete()) before or after env.project.write/
env.close() to ensure the temp src folder and written sources are removed;
reference the tempDir TemporaryFolder instance and the env teardown block (the
finally that currently checks ::env.isInitialized and calls env.project.write)
and add the explicit cleanup call there so temporary files are removed even when
tests fail.
In `@subprojects/kotlin-analysis-api/build.gradle.kts`:
- Around line 12-31: Replace the local absolute-file dependency in the
dependencies { api(files(...)) } block with the original externalAssets {
jarDependency("kt-android") { ... } } wiring: restore the externalAssets block
that uses AssetSource.External(url = uri(...), sha256Checksum = "..."), re-add
the AssetSource import if removed, and remove the hardcoded api(files(...))
entry so the build fetches the shared kt-android JAR via the external asset
mechanism with integrity verification.
---
Nitpick comments:
In
`@lsp/kotlin/src/test/java/com/itsaky/androidide/lsp/kotlin/fixtures/KtLspTestRule.kt`:
- Around line 30-33: The env.project.write { } block is a no-op because
env.close() is commented out, so ensure the test environment is reliably torn
down by calling env.close() from the rule's teardown rather than leaving it
inside the write block: move the disposal into a proper tearDown/after method in
KtLspTestRule, call env.close() (or Disposer.dispose(env) if close() is
unstable) inside a try/catch to swallow/log any exceptions, and null out the env
reference after successful disposal so resources are released between tests;
reference env, env.close(), env.project.write { }, and the KtLspTestRule
teardown method when applying the change.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 1fd0c255-3161-4eb6-b157-b71e6449a3ad
📒 Files selected for processing (29)
app/src/main/java/com/itsaky/androidide/app/IDEApplication.ktlsp/indexing/src/main/kotlin/org/appdevforall/codeonthego/indexing/FilteredIndex.ktlsp/indexing/src/main/kotlin/org/appdevforall/codeonthego/indexing/InMemoryIndex.ktlsp/jvm-symbol-index/src/main/kotlin/org/appdevforall/codeonthego/indexing/jvm/JvmSymbolIndex.ktlsp/jvm-symbol-index/src/main/kotlin/org/appdevforall/codeonthego/indexing/jvm/KtFileMetadataIndex.ktlsp/kotlin/src/main/java/com/itsaky/androidide/lsp/kotlin/KotlinLanguageServer.ktlsp/kotlin/src/main/java/com/itsaky/androidide/lsp/kotlin/compiler/AbstractCompilationEnvironment.ktlsp/kotlin/src/main/java/com/itsaky/androidide/lsp/kotlin/compiler/CompilationEnvironment.ktlsp/kotlin/src/main/java/com/itsaky/androidide/lsp/kotlin/compiler/index/SourceFileIndexer.ktlsp/kotlin/src/main/java/com/itsaky/androidide/lsp/kotlin/compiler/modules/AbstractKtModule.ktlsp/kotlin/src/main/java/com/itsaky/androidide/lsp/kotlin/compiler/modules/AbstractSourceModule.ktlsp/kotlin/src/main/java/com/itsaky/androidide/lsp/kotlin/compiler/modules/KtSourceModule.ktlsp/kotlin/src/main/java/com/itsaky/androidide/lsp/kotlin/compiler/registrar/AnalysisApiServiceProvider.ktlsp/kotlin/src/main/java/com/itsaky/androidide/lsp/kotlin/compiler/registrar/AnalysisApiServiceProviders.ktlsp/kotlin/src/main/java/com/itsaky/androidide/lsp/kotlin/compiler/registrar/LspAnalysisApiServiceRegistrar.ktlsp/kotlin/src/main/java/com/itsaky/androidide/lsp/kotlin/compiler/registrar/LspServiceRegistrar.ktlsp/kotlin/src/main/java/com/itsaky/androidide/lsp/kotlin/compiler/services/AnalysisPermissionOptions.ktlsp/kotlin/src/main/java/com/itsaky/androidide/lsp/kotlin/compiler/services/DeclarationsProvider.ktlsp/kotlin/src/main/java/com/itsaky/androidide/lsp/kotlin/compiler/services/ProjectStructureProvider.ktlsp/kotlin/src/test/java/com/itsaky/androidide/lsp/kotlin/compiler/index/SourceFileIndexerTest.ktlsp/kotlin/src/test/java/com/itsaky/androidide/lsp/kotlin/compiler/modules/ContentScopeStalenessTest.ktlsp/kotlin/src/test/java/com/itsaky/androidide/lsp/kotlin/fixtures/KtLspTest.ktlsp/kotlin/src/test/java/com/itsaky/androidide/lsp/kotlin/fixtures/KtLspTestEnvironment.ktlsp/kotlin/src/test/java/com/itsaky/androidide/lsp/kotlin/fixtures/KtLspTestEnvironmentTest.ktlsp/kotlin/src/test/java/com/itsaky/androidide/lsp/kotlin/fixtures/KtLspTestRule.ktlsp/kotlin/src/test/java/com/itsaky/androidide/lsp/kotlin/fixtures/TestKtSourceModule.ktshared/src/main/java/com/itsaky/androidide/utils/Either.ktsubprojects/kotlin-analysis-api/build.gradle.ktstesting/lsp/src/main/java/com/itsaky/androidide/lsp/api/LSPTest.kt
💤 Files with no reviewable changes (2)
- lsp/kotlin/src/main/java/com/itsaky/androidide/lsp/kotlin/compiler/registrar/LspServiceRegistrar.kt
- app/src/main/java/com/itsaky/androidide/app/IDEApplication.kt
Signed-off-by: Akash Yadav <akashyadav@appdevforall.org>
See ADFA-4059 for more details.