mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-13 15:52:01 +07:00
[K/Wasm] Introduce a custom variable view for the Kotlin/Wasm debugging
^FL-29566 Fixed ^KT-67797 Fixed Merge-request: IJ-MR-144154 Merged-by: Artem Kobzar <Artem.Kobzar@jetbrains.com> GitOrigin-RevId: 6192180d3ff4bda44e86e556150a0e9e15c31085
This commit is contained in:
committed by
intellij-monorepo-bot
parent
338475c607
commit
039d9c4098
@@ -30,6 +30,8 @@ enum class ScopeType {
|
||||
INSTANCE,
|
||||
BLOCK,
|
||||
SCRIPT,
|
||||
STACK,
|
||||
MODULE,
|
||||
UNKNOWN
|
||||
}
|
||||
|
||||
|
||||
@@ -251,6 +251,7 @@ f:org.jetbrains.concurrency.Promises
|
||||
- sf:createError(java.lang.String,Z):java.lang.RuntimeException
|
||||
- bs:createError$default(java.lang.String,Z,I,java.lang.Object):java.lang.RuntimeException
|
||||
- sf:errorIfNotMessage(com.intellij.openapi.diagnostic.Logger,java.lang.Throwable):Z
|
||||
- sf:first(java.util.Collection,org.jetbrains.concurrency.Obsolescent,kotlin.jvm.functions.Function1):org.jetbrains.concurrency.Promise
|
||||
- sf:isPending(org.jetbrains.concurrency.Promise):Z
|
||||
- sf:isRejected(org.jetbrains.concurrency.Promise):Z
|
||||
- sf:nullPromise():org.jetbrains.concurrency.Promise
|
||||
@@ -273,6 +274,7 @@ f:org.jetbrains.concurrency.Promises
|
||||
- sf:thenRun(org.jetbrains.concurrency.Promise,kotlin.jvm.functions.Function0):org.jetbrains.concurrency.Promise
|
||||
- sf:toActionCallback(org.jetbrains.concurrency.Promise):com.intellij.openapi.util.ActionCallback
|
||||
- sf:toPromise(com.intellij.openapi.util.ActionCallback):org.jetbrains.concurrency.Promise
|
||||
- sf:waitAll(java.util.Collection,org.jetbrains.concurrency.Obsolescent):org.jetbrains.concurrency.Promise
|
||||
a:org.jetbrains.concurrency.ValueNodeAsyncFunction
|
||||
- com.intellij.util.Function
|
||||
- org.jetbrains.concurrency.Obsolescent
|
||||
|
||||
@@ -19,6 +19,7 @@ import java.util.concurrent.CompletableFuture
|
||||
import java.util.concurrent.Future
|
||||
import java.util.concurrent.TimeUnit
|
||||
import java.util.concurrent.atomic.AtomicInteger
|
||||
import java.util.function.BiConsumer
|
||||
import java.util.function.Consumer
|
||||
|
||||
private val obsoleteError: RuntimeException by lazy { MessageError("Obsolete", false) }
|
||||
@@ -378,6 +379,73 @@ fun <T> any(promises: Collection<Promise<T>>, totalError: String): Promise<T> {
|
||||
return totalPromise
|
||||
}
|
||||
|
||||
|
||||
fun <T> Collection<Promise<T>>.waitAll(node: Obsolescent): Promise<List<T>> {
|
||||
if (isEmpty()) {
|
||||
return resolvedPromise(emptyList())
|
||||
}
|
||||
else if (size == 1) {
|
||||
return first().then(node, ::listOf)
|
||||
}
|
||||
|
||||
val totalPromise = AsyncPromise<List<T>>()
|
||||
|
||||
val done = object : BiConsumer<Int, T> {
|
||||
val toConsume = AtomicInteger(size)
|
||||
val result = Collections.synchronizedList(
|
||||
MutableList<T?>(size) { null }
|
||||
)
|
||||
|
||||
override fun accept(index: Int, t: T) {
|
||||
result[index] = t
|
||||
if (toConsume.decrementAndGet() <= 0) {
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
totalPromise.setResult(result as List<T>)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
val rejected = Consumer<Throwable> { throwable -> totalPromise.setError(throwable) }
|
||||
|
||||
for ((index, promise) in withIndex()) {
|
||||
promise.onSuccess(node) { done.accept(index, it) }
|
||||
promise.onError(node, rejected::accept)
|
||||
}
|
||||
|
||||
return totalPromise
|
||||
}
|
||||
|
||||
fun <T> Collection<T>.first(node: Obsolescent, predicate: (T) -> Promise<Boolean>): Promise<T?> {
|
||||
if (isEmpty()) {
|
||||
return resolvedPromise()
|
||||
}
|
||||
|
||||
val totalPromise = AsyncPromise<T?>()
|
||||
val toConsume = AtomicInteger(size)
|
||||
|
||||
val done = Consumer<T?> { value ->
|
||||
if (value != null) {
|
||||
totalPromise.setResult(value)
|
||||
} else if (toConsume.decrementAndGet() <= 0) {
|
||||
totalPromise.setResult(null)
|
||||
}
|
||||
}
|
||||
|
||||
val rejected = Consumer<Throwable> { throwable ->
|
||||
if (toConsume.decrementAndGet() <= 0) {
|
||||
totalPromise.setError(throwable)
|
||||
}
|
||||
}
|
||||
|
||||
for (element in this) {
|
||||
predicate(element)
|
||||
.then(node) { matched -> done.accept(element.takeIf { matched }) }
|
||||
.onError(node) { rejected.accept(it) }
|
||||
}
|
||||
|
||||
return totalPromise
|
||||
}
|
||||
|
||||
private class DonePromise<T>(private val value: PromiseValue<T>) : Promise<T>, Future<T>, CancellablePromise<T> {
|
||||
/**
|
||||
* The same as @{link Future[Future.isDone]}.
|
||||
|
||||
@@ -173,6 +173,8 @@ scope.instance = Instance
|
||||
scope.library = Library
|
||||
scope.block = Block
|
||||
scope.script = Script
|
||||
scope.stack = Values
|
||||
scope.module = WebAssembly Module
|
||||
scope.unknown = Unknown
|
||||
|
||||
setting.value.tooltip.delay.label=&Value tooltip delay (ms):
|
||||
|
||||
Reference in New Issue
Block a user