mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-10-01 15:15:45 +07:00
[rd debugger] Implemented FrontendXValueMarkers#canMarkValue/clear
IJPL-176964 GitOrigin-RevId: f55598a42dc7478968bacd110ada158ea7120b95
This commit is contained in:
committed by
intellij-monorepo-bot
parent
a26e66f55f
commit
8e0590d2b6
+7
@@ -6,9 +6,11 @@ import com.intellij.platform.debugger.impl.rpc.XValueMarkerDto
|
||||
import com.intellij.ui.JBColor
|
||||
import com.intellij.xdebugger.impl.XDebugSessionImpl
|
||||
import com.intellij.xdebugger.impl.frame.XValueMarkers
|
||||
import com.intellij.xdebugger.impl.rpc.XDebugSessionId
|
||||
import com.intellij.xdebugger.impl.rpc.XValueId
|
||||
import com.intellij.xdebugger.impl.rpc.models.BackendXValueModel
|
||||
import com.intellij.xdebugger.impl.rpc.models.BackendXValueModelsManager
|
||||
import com.intellij.xdebugger.impl.rpc.models.findValue
|
||||
import com.intellij.xdebugger.impl.ui.tree.ValueMarkup
|
||||
import org.jetbrains.concurrency.await
|
||||
|
||||
@@ -32,6 +34,11 @@ internal class BackendXDebuggerValueMarkupApi : XDebuggerValueMarkupApi {
|
||||
updateMarkersForAllXValueModels(markers, session)
|
||||
}
|
||||
|
||||
override suspend fun clear(xDebugSessionId: XDebugSessionId) {
|
||||
val session = xDebugSessionId.findValue() ?: return
|
||||
session.getValueMarkers()?.clear()
|
||||
}
|
||||
|
||||
private fun updateMarkersForAllXValueModels(markers: XValueMarkers<*, *>, session: XDebugSessionImpl) {
|
||||
val sessionXValueModels = BackendXValueModelsManager.getInstance(session.project).getXValueModelsForSession(session)
|
||||
// TODO[IJPL-160146]: Don't update all the xValues, since some markers may not be changed
|
||||
|
||||
+12
-3
@@ -9,11 +9,14 @@ import com.intellij.platform.debugger.impl.rpc.XDebuggerValueMarkupApi
|
||||
import com.intellij.platform.debugger.impl.rpc.XValueMarkerDto
|
||||
import com.intellij.ui.JBColor
|
||||
import com.intellij.xdebugger.frame.XValue
|
||||
import com.intellij.xdebugger.impl.frame.XDebugManagerProxy
|
||||
import com.intellij.xdebugger.impl.frame.XDebugSessionProxy
|
||||
import com.intellij.xdebugger.impl.frame.XValueMarkers
|
||||
import com.intellij.xdebugger.impl.ui.tree.ValueMarkup
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.async
|
||||
import kotlinx.coroutines.future.asCompletableFuture
|
||||
import kotlinx.coroutines.launch
|
||||
import org.jetbrains.concurrency.Promise
|
||||
import org.jetbrains.concurrency.asPromise
|
||||
|
||||
@@ -25,8 +28,7 @@ internal class FrontendXValueMarkers<V : XValue, M>(private val project: Project
|
||||
}
|
||||
|
||||
override fun canMarkValue(value: XValue): Boolean {
|
||||
// TODO[IJPL-160146]: Implement canMarkValue
|
||||
return true
|
||||
return FrontendXValue.asFrontendXValueOrNull(value)?.canMarkValue ?: false
|
||||
}
|
||||
|
||||
override fun markValue(value: XValue, markup: ValueMarkup): Promise<in Any> {
|
||||
@@ -43,7 +45,8 @@ internal class FrontendXValueMarkers<V : XValue, M>(private val project: Project
|
||||
}
|
||||
|
||||
override fun clear() {
|
||||
// TODO[IJPL-160146]: Implement clear
|
||||
val debugSessionProxy = XDebugManagerProxy.getInstance().getCurrentSessionProxy(project) ?: return
|
||||
project.service<FrontendXValueMarkersService>().clear(debugSessionProxy)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,4 +68,10 @@ private class FrontendXValueMarkersService(project: Project, private val cs: Cor
|
||||
}
|
||||
return valueUnmarked.asCompletableFuture().asPromise()
|
||||
}
|
||||
|
||||
fun clear(debugSessionProxy: XDebugSessionProxy) {
|
||||
cs.launch {
|
||||
XDebuggerValueMarkupApi.getInstance().clear(debugSessionProxy.id)
|
||||
}
|
||||
}
|
||||
}
|
||||
+8
@@ -64,6 +64,10 @@ class FrontendXValue private constructor(
|
||||
@Volatile
|
||||
private var canNavigateToTypeSource = false
|
||||
|
||||
@Volatile
|
||||
var canMarkValue: Boolean = false
|
||||
private set
|
||||
|
||||
private val xValueContainer = FrontendXValueContainer(project, cs, hasParentValue) {
|
||||
XValueApi.getInstance().computeChildren(xValueDto.id)
|
||||
}
|
||||
@@ -110,6 +114,10 @@ class FrontendXValue private constructor(
|
||||
cs.launch {
|
||||
canNavigateToTypeSource = xValueDto.canNavigateToTypeSource.await()
|
||||
}
|
||||
|
||||
cs.launch {
|
||||
canMarkValue = xValueDto.canMarkValue.await()
|
||||
}
|
||||
}
|
||||
|
||||
override fun canNavigateToSource(): Boolean {
|
||||
|
||||
+1
@@ -106,6 +106,7 @@ data class XValueDto(
|
||||
val canNavigateToSource: Boolean,
|
||||
@Serializable(with = DeferredSerializer::class) val canNavigateToTypeSource: Deferred<Boolean>,
|
||||
@Serializable(with = DeferredSerializer::class) val canBeModified: Deferred<Boolean>,
|
||||
@Serializable(with = DeferredSerializer::class) val canMarkValue: Deferred<Boolean>,
|
||||
val valueMark: RpcFlow<XValueMarkerDto?>,
|
||||
val presentation: RpcFlow<XValueSerializedPresentation>,
|
||||
val fullValueEvaluator: RpcFlow<XFullValueEvaluatorDto?>,
|
||||
|
||||
+3
@@ -2,6 +2,7 @@
|
||||
package com.intellij.platform.debugger.impl.rpc
|
||||
|
||||
import com.intellij.platform.rpc.RemoteApiProviderService
|
||||
import com.intellij.xdebugger.impl.rpc.XDebugSessionId
|
||||
import com.intellij.xdebugger.impl.rpc.XValueId
|
||||
import fleet.rpc.RemoteApi
|
||||
import fleet.rpc.Rpc
|
||||
@@ -15,6 +16,8 @@ interface XDebuggerValueMarkupApi : RemoteApi<Unit> {
|
||||
|
||||
suspend fun unmarkValue(xValueId: XValueId)
|
||||
|
||||
suspend fun clear(xDebugSessionId: XDebugSessionId)
|
||||
|
||||
companion object {
|
||||
@JvmStatic
|
||||
suspend fun getInstance(): XDebuggerValueMarkupApi {
|
||||
|
||||
+4
@@ -132,6 +132,9 @@ suspend fun BackendXValueModel.toXValueDto(): XValueDto {
|
||||
val valueMarkupFlow: RpcFlow<XValueMarkerDto?> = xValueModel.marker.toRpc()
|
||||
|
||||
val textProvider = getTextProviderFlow(xValue, xValueModel)
|
||||
val canMarkValue = xValue.isReady.thenApply {
|
||||
session.getValueMarkers()?.canMarkValue(xValue) ?: false
|
||||
}
|
||||
|
||||
return XValueDto(
|
||||
xValueModel.id,
|
||||
@@ -139,6 +142,7 @@ suspend fun BackendXValueModel.toXValueDto(): XValueDto {
|
||||
canNavigateToSource = xValue.canNavigateToSource(),
|
||||
canNavigateToTypeSource = xValue.canNavigateToTypeSourceAsync().asDeferred(),
|
||||
canBeModified = xValue.modifierAsync.thenApply { modifier -> modifier != null }.asDeferred(),
|
||||
canMarkValue = canMarkValue.asDeferred(),
|
||||
valueMarkupFlow,
|
||||
xValueModel.presentation.toRpc(),
|
||||
xValueModel.getEvaluatorDtoFlow().toRpc(),
|
||||
|
||||
Reference in New Issue
Block a user