LLM-979 Implement AI Assistant activation workflow

- Implemented settings states

GitOrigin-RevId: d9e2653f445fc146521f42c300b7ce1a83e1de2c
This commit is contained in:
Pavel Porvatov
2023-10-27 11:01:59 +02:00
committed by intellij-monorepo-bot
parent bc37cc0a28
commit 3a5004b0ac

View File

@@ -6,6 +6,8 @@ import com.intellij.openapi.application.ApplicationManager
import com.intellij.openapi.observable.properties.ObservableProperty
import com.intellij.openapi.observable.properties.whenPropertyChanged
import com.intellij.openapi.application.EDT
import com.intellij.openapi.application.ModalityState
import com.intellij.openapi.application.asContextElement
import com.intellij.openapi.options.advanced.AdvancedSettings
import com.intellij.openapi.options.advanced.AdvancedSettingsChangeListener
import com.intellij.ui.DocumentAdapter
@@ -113,7 +115,7 @@ fun <T> StateFlow<T>.predicate(scope: CoroutineScope, predicate: (T) -> Boolean)
override fun addListener(listener: (Boolean) -> Unit) {
scope.launch {
collect { value ->
withContext(Dispatchers.EDT) {
withContext(Dispatchers.EDT + ModalityState.any().asContextElement()) {
listener(predicate(value))
}
}