From cb2ab4676bd2989b5f9761063d971bd2fdd61a9f Mon Sep 17 00:00:00 2001 From: Vladimir Ilmov Date: Fri, 17 Jul 2020 14:49:15 +0200 Subject: [PATCH] (CoroutineDebugger) Top node added to prevent dumpCoroutine() call Panel gather information from the agent on each breakpoint hit. --- .../KotlinDebuggerCoroutinesBundle.properties | 1 + .../idea/debugger/coroutine/view/XCoroutineView.kt | 14 +++++++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/idea/jvm-debugger/jvm-debugger-coroutine/resources/messages/KotlinDebuggerCoroutinesBundle.properties b/idea/jvm-debugger/jvm-debugger-coroutine/resources/messages/KotlinDebuggerCoroutinesBundle.properties index ab9b160a381..876e212f7e2 100644 --- a/idea/jvm-debugger/jvm-debugger-coroutine/resources/messages/KotlinDebuggerCoroutinesBundle.properties +++ b/idea/jvm-debugger/jvm-debugger-coroutine/resources/messages/KotlinDebuggerCoroutinesBundle.properties @@ -18,6 +18,7 @@ coroutine.dump.creation.trace=Coroutine creation stack trace coroutine.dump.threads.loading=Loading… +coroutine.view.node.root=Coroutines coroutine.view.title=Coroutines coroutine.view.dispatcher.empty=Empty dispatcher coroutine.view.fetching.error=An error occurred on fetching information diff --git a/idea/jvm-debugger/jvm-debugger-coroutine/src/org/jetbrains/kotlin/idea/debugger/coroutine/view/XCoroutineView.kt b/idea/jvm-debugger/jvm-debugger-coroutine/src/org/jetbrains/kotlin/idea/debugger/coroutine/view/XCoroutineView.kt index 300cd034792..5a57cd48fd3 100644 --- a/idea/jvm-debugger/jvm-debugger-coroutine/src/org/jetbrains/kotlin/idea/debugger/coroutine/view/XCoroutineView.kt +++ b/idea/jvm-debugger/jvm-debugger-coroutine/src/org/jetbrains/kotlin/idea/debugger/coroutine/view/XCoroutineView.kt @@ -135,12 +135,20 @@ class XCoroutineView(val project: Project, val session: XDebugSession) : inner class EmptyNode : XValueContainerNode(panel.tree, null, true, object : XValueContainer() {}) inner class XCoroutinesRootNode(suspendContext: SuspendContextImpl) : - XValueContainerNode( + XValueContainerNode( panel.tree, null, false, - CoroutineGroupContainer(suspendContext) + CoroutineTopGroupContainer(suspendContext) ) - inner class CoroutineGroupContainer(val suspendContext: SuspendContextImpl) : XValueContainer() { + inner class CoroutineTopGroupContainer(val suspendContext: SuspendContextImpl) : XValueContainer() { + override fun computeChildren(node: XCompositeNode) { + val children = XValueChildrenList() + children.add(CoroutineGroupContainer(suspendContext)) + node.addChildren(children, true) + } + } + + inner class CoroutineGroupContainer(val suspendContext: SuspendContextImpl) : RendererContainer(renderer.renderGroup(KotlinDebuggerCoroutinesBundle.message("coroutine.view.node.root"))) { override fun computeChildren(node: XCompositeNode) { if (suspendContext.suspendPolicy == EventRequest.SUSPEND_ALL) { managerThreadExecutor.on(suspendContext).invoke {