mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
WEB-13024 show JS async call stack
This commit is contained in:
@@ -49,4 +49,6 @@ interface CallFrame {
|
||||
* @see com.intellij.xdebugger.frame.XStackFrame.getEqualityObject
|
||||
*/
|
||||
val equalityObject: Any
|
||||
|
||||
val asyncFunctionName: String?
|
||||
}
|
||||
@@ -36,4 +36,6 @@ abstract class CallFrameBase(override val functionName: String?, override val li
|
||||
|
||||
override val variableScopes: List<Scope>
|
||||
get() = scopes!!.value
|
||||
|
||||
override val asyncFunctionName: String? = null
|
||||
}
|
||||
+32
@@ -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())
|
||||
+3
-1
@@ -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)) {
|
||||
|
||||
+8
@@ -44,6 +44,7 @@ internal class ExecutionStackImpl(private val suspendContext: SuspendContext<out
|
||||
}
|
||||
else {
|
||||
result = ArrayList<XStackFrame>(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<out
|
||||
}
|
||||
|
||||
val frame = frames[i]
|
||||
val asyncFunctionName = frame.asyncFunctionName
|
||||
if (asyncFunctionName != null) {
|
||||
if (!asyncFunctionName.equals(prevAsyncFunctionName)) {
|
||||
result.add(AsyncFramesHeader(asyncFunctionName))
|
||||
}
|
||||
prevAsyncFunctionName = asyncFunctionName
|
||||
}
|
||||
// if script is null, it is native function (Object.forEach for example), so, skip it
|
||||
val script = viewSupport.vm?.scriptManager?.getScript(frame)
|
||||
if (script != null) {
|
||||
|
||||
Reference in New Issue
Block a user