diff --git a/platform/script-debugger/backend/src/CallFrame.kt b/platform/script-debugger/backend/src/CallFrame.kt index 5ba4064e4fa9..c9091357f9b3 100755 --- a/platform/script-debugger/backend/src/CallFrame.kt +++ b/platform/script-debugger/backend/src/CallFrame.kt @@ -49,4 +49,6 @@ interface CallFrame { * @see com.intellij.xdebugger.frame.XStackFrame.getEqualityObject */ val equalityObject: Any + + val asyncFunctionName: String? } \ No newline at end of file diff --git a/platform/script-debugger/backend/src/CallFrameBase.kt b/platform/script-debugger/backend/src/CallFrameBase.kt index 3815e8d32446..c494c6a4cc16 100644 --- a/platform/script-debugger/backend/src/CallFrameBase.kt +++ b/platform/script-debugger/backend/src/CallFrameBase.kt @@ -36,4 +36,6 @@ abstract class CallFrameBase(override val functionName: String?, override val li override val variableScopes: List get() = scopes!!.value + + override val asyncFunctionName: String? = null } \ No newline at end of file diff --git a/platform/script-debugger/debugger-ui/src/org/jetbrains/debugger/frame/AsyncFramesHeader.kt b/platform/script-debugger/debugger-ui/src/org/jetbrains/debugger/frame/AsyncFramesHeader.kt new file mode 100644 index 000000000000..3c6c267fb24d --- /dev/null +++ b/platform/script-debugger/debugger-ui/src/org/jetbrains/debugger/frame/AsyncFramesHeader.kt @@ -0,0 +1,32 @@ +/* + * Copyright 2000-2015 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.jetbrains.debugger.frame + +import com.intellij.ui.ColoredTextContainer +import com.intellij.ui.SimpleTextAttributes +import com.intellij.util.ui.UIUtil +import com.intellij.xdebugger.frame.XStackFrame + +class AsyncFramesHeader(val asyncFunctionName: String) : XStackFrame() { + override fun customizePresentation(component: ColoredTextContainer) { + component.append("Async call from ", PREFIX_ATTRIBUTES) + component.append(asyncFunctionName, NAME_ATTRIBUTES) + } +} + +private val PREFIX_ATTRIBUTES = SimpleTextAttributes(SimpleTextAttributes.STYLE_ITALIC, UIUtil.getInactiveTextColor()) +private val NAME_ATTRIBUTES = SimpleTextAttributes(SimpleTextAttributes.STYLE_ITALIC or SimpleTextAttributes.STYLE_BOLD, + UIUtil.getInactiveTextColor()) \ No newline at end of file diff --git a/platform/script-debugger/debugger-ui/src/org/jetbrains/debugger/frame/CallFrameView.kt b/platform/script-debugger/debugger-ui/src/org/jetbrains/debugger/frame/CallFrameView.kt index 63534eefbf7c..67866295887b 100644 --- a/platform/script-debugger/debugger-ui/src/org/jetbrains/debugger/frame/CallFrameView.kt +++ b/platform/script-debugger/debugger-ui/src/org/jetbrains/debugger/frame/CallFrameView.kt @@ -77,7 +77,9 @@ class CallFrameView @JvmOverloads constructor(val callFrame: CallFrame, val fileName = sourceInfo.file.name val line = sourceInfo.line + 1 - val textAttributes = if (isInLibraryContent) SimpleTextAttributes.GRAYED_ATTRIBUTES else SimpleTextAttributes.REGULAR_ATTRIBUTES + val textAttributes = + if (isInLibraryContent || callFrame.asyncFunctionName != null) SimpleTextAttributes.GRAYED_ATTRIBUTES + else SimpleTextAttributes.REGULAR_ATTRIBUTES val functionName = sourceInfo.functionName if (functionName == null || (functionName.isEmpty() && callFrame.hasOnlyGlobalScope)) { diff --git a/platform/script-debugger/debugger-ui/src/org/jetbrains/debugger/frame/ExecutionStackImpl.kt b/platform/script-debugger/debugger-ui/src/org/jetbrains/debugger/frame/ExecutionStackImpl.kt index 29269cb58752..24f84e51fc9b 100644 --- a/platform/script-debugger/debugger-ui/src/org/jetbrains/debugger/frame/ExecutionStackImpl.kt +++ b/platform/script-debugger/debugger-ui/src/org/jetbrains/debugger/frame/ExecutionStackImpl.kt @@ -44,6 +44,7 @@ internal class ExecutionStackImpl(private val suspendContext: SuspendContext(count) + var prevAsyncFunctionName: String? = null for (i in firstFrameIndex..frames.size - 1) { if (i == 0) { result.add(topFrame!!) @@ -51,6 +52,13 @@ internal class ExecutionStackImpl(private val suspendContext: SuspendContext