[debugger-split] RIDER-134022. Review feedback

(cherry picked from commit e1fd507ce4434296e9421d9fd702f3790cbb04a0)

GitOrigin-RevId: 34936f92087f05bae20252bd8f7673e5b09e75e3
This commit is contained in:
Evgeny.Terekhin
2026-03-03 09:11:04 +00:00
committed by intellij-monorepo-bot
parent 8c79fa11ff
commit 8b9ef77353
4 changed files with 15 additions and 8 deletions
@@ -12,8 +12,6 @@ import com.intellij.platform.debugger.impl.rpc.XStackFrameId
import com.intellij.platform.debugger.impl.rpc.XStackFramePresentation
import com.intellij.platform.debugger.impl.rpc.XStackFramePresentationFragment
import com.intellij.platform.debugger.impl.rpc.XStackFramesEvent
import com.intellij.platform.debugger.impl.rpc.toRpc
import com.intellij.xdebugger.frame.XExecutionStack
import com.intellij.xdebugger.frame.XStackFrame
import com.intellij.xdebugger.impl.frame.XStackFrameContainerEx
import com.intellij.xdebugger.impl.rpc.models.findValue
@@ -61,8 +59,11 @@ internal class BackendXExecutionStackApi : XExecutionStackApi {
val frameDtos = framesCopy.map { frame ->
frame.toRpc(executionStackModel.coroutineScope, session)
}
val frameToSelect = toSelect?.toRpc(executionStackModel.coroutineScope, session)
trySend(XStackFramesEvent.XNewStackFrames(frameDtos, frameToSelect, last))
val frameToSelectId = toSelect?.let {
val index = framesCopy.indexOf(it)
if (index >= 0) frameDtos[index].stackFrameId else null
}
trySend(XStackFramesEvent.XNewStackFrames(frameDtos, frameToSelectId, last))
val framesWithIds = frameDtos.zip(framesCopy) { dto, frame -> dto.stackFrameId to frame }
subscribeToPresentationUpdates(executionStackId, framesWithIds, last)
}
@@ -65,11 +65,14 @@ internal class FrontendXExecutionStack(
// But it requires further investigation.
val feFrames = event.frames.map { suspendContextLifetimeScope.getOrCreateStackFrame(it, project) }
if (container is XStackFrameContainerEx) {
val frameToSelect = event.frameToSelect?.let { suspendContextLifetimeScope.getOrCreateStackFrame(it, project) }
val frameToSelect = event.frameToSelectId?.let { frameToSelectId ->
feFrames.firstOrNull { it.id == frameToSelectId }
}
container.addStackFrames(feFrames, frameToSelect, event.last)
}
else
else {
container.addStackFrames(feFrames, event.last)
}
}
is XStackFramesEvent.NewPresentation -> {
val frame = suspendContextLifetimeScope.findStackFrame(event.stackFrameId)
@@ -16,7 +16,7 @@ import org.jetbrains.annotations.ApiStatus
sealed interface XStackFramesEvent {
@ApiStatus.Internal
@Serializable
data class XNewStackFrames(val frames: List<XStackFrameDto>, val frameToSelect : XStackFrameDto?, val last: Boolean) : XStackFramesEvent
data class XNewStackFrames(val frames: List<XStackFrameDto>, val frameToSelectId: XStackFrameId?, val last: Boolean) : XStackFramesEvent
@Serializable
data class ErrorOccurred(val errorMessage: @NlsContexts.DialogMessage String) : XStackFramesEvent
@@ -23,6 +23,8 @@ import javax.swing.JComponent
import javax.swing.JPanel
import kotlin.time.Duration.Companion.milliseconds
private val LOG = com.intellij.openapi.diagnostic.logger<XSplitterWatchesViewImpl>()
/**
* Allows customizing of variables view and splitting into 2 components.
* Notice that you must provide the bottom component of the view by implementing XDebugSessionTabCustomizer in your XDebugProcess
@@ -63,7 +65,8 @@ class XSplitterWatchesViewImpl(
try {
withContext(Dispatchers.EDT) { updateView() }
}
catch (_: Throwable) {
catch (ex: Throwable) {
LOG.warn("Failed to update watches view", ex)
}
}
}