Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lsp/kotlin/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ dependencies {
implementation(libs.common.kotlin)
implementation(libs.common.kotlin.coroutines.core)
implementation(libs.common.kotlin.coroutines.android)
implementation(libs.sentry.android.core)

compileOnly(projects.common)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ import com.itsaky.androidide.tasks.createJobCancelChecker
import com.itsaky.androidide.utils.DocumentUtils
import com.itsaky.androidide.utils.Environment
import com.itsaky.androidide.utils.ifNotEmpty
import io.sentry.Sentry
import kotlinx.coroutines.CoroutineName
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.SupervisorJob
Expand Down Expand Up @@ -321,6 +322,7 @@ class KotlinLanguageServer : ILanguageServer {
@Subscribe
@Suppress("unused")
fun onBuildCompleted(event: BuildCompletedEvent) {
Sentry.addBreadcrumb("onBuildCompleted: result=${event.result}")
compiler?.refreshSources()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import com.itsaky.androidide.lsp.kotlin.utils.toVirtualFileOrNull
import com.itsaky.androidide.projects.FileManager
import com.itsaky.androidide.projects.api.Workspace
import com.itsaky.androidide.utils.KeyedDebouncingAction
import io.sentry.Sentry
import kotlinx.coroutines.CoroutineName
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
Expand Down Expand Up @@ -118,7 +119,7 @@ import kotlin.time.Duration.Companion.milliseconds
@Suppress("UnstableApiUsage")
@OptIn(K1Deprecation::class)
internal class CompilationEnvironment(
name: String,
val name: String,
val kind: CompilationKind,
workspace: Workspace,
val ktProject: KotlinProjectModel,
Expand Down Expand Up @@ -408,12 +409,16 @@ internal class CompilationEnvironment(
}

fun refreshSources() {
ResolutionScopeProvider.getInstance(project)
.invalidateAll()
Sentry.addBreadcrumb("refreshSources (env=${name}, modules=${modules.size})")
project.write {
Sentry.addBreadcrumb("refreshSources(env=${name}): in-progress")
ResolutionScopeProvider.getInstance(project)
.invalidateAll()

modules.asFlatSequence()
.filterIsInstance<AbstractKtModule>()
.forEach { it.invalidateSearchScope() }
modules.asFlatSequence()
.filterIsInstance<AbstractKtModule>()
.forEach { it.invalidateSearchScope() }
}

ktSymbolIndex.refreshSources()
// TODO: Should also update/notify Java file services about possibly changed Java files
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import com.itsaky.androidide.lsp.kotlin.compiler.modules.KtModule
import com.itsaky.androidide.lsp.kotlin.compiler.read
import com.itsaky.androidide.lsp.kotlin.utils.toVirtualFileOrNull
import com.itsaky.androidide.utils.DocumentUtils
import io.sentry.Sentry
import kotlinx.coroutines.CoroutineName
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
Expand Down Expand Up @@ -117,6 +118,7 @@ internal class KtSymbolIndex(
}

fun refreshSources() {
Sentry.addBreadcrumb("KtSymbolIndex.refreshSources()")
indexingJob ?: startIndexing()

scanningJob?.cancel()
Expand Down
Loading
Loading