mirror of
https://github.com/DaanVandenBosch/phantasmal-world.git
synced 2025-04-07 08:48:28 +08:00
Upgraded to monaco-editor 0.26.1.
This commit is contained in:
parent
295dd6a253
commit
6cf0fdaf33
@ -290,7 +290,7 @@ class AsmAnalyser {
|
||||
val result = bytecodeIr.segments.asSequence()
|
||||
.flatMap { segment ->
|
||||
segment.labels.mapIndexed { labelIdx, label ->
|
||||
val range = segment.srcLoc.labels.getOrNull(labelIdx)?.toAsmRange()
|
||||
val range = segment.srcLoc.labels[labelIdx].toAsmRange()
|
||||
Label(name = label, range)
|
||||
}
|
||||
}
|
||||
|
@ -33,15 +33,12 @@ dependencies {
|
||||
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:$serializationVersion")
|
||||
implementation("org.jetbrains.kotlinx:kotlinx-datetime:0.2.1")
|
||||
implementation(npm("golden-layout", "^1.5.9"))
|
||||
// Can't upgrade monaco-editor until https://github.com/microsoft/monaco-editor/issues/2466 is
|
||||
// fixed.
|
||||
implementation(npm("monaco-editor", "0.20.0"))
|
||||
implementation(npm("monaco-editor", "0.26.1"))
|
||||
implementation(npm("three", "^0.128.0"))
|
||||
implementation(npm("javascript-lp-solver", "0.4.17"))
|
||||
|
||||
implementation(devNpm("file-loader", "^6.2.0"))
|
||||
// Can't upgrade monaco-editor-webpack-plugin until monaco-editor is upgraded.
|
||||
implementation(devNpm("monaco-editor-webpack-plugin", "1.9.1"))
|
||||
implementation(devNpm("monaco-editor-webpack-plugin", "4.1.1"))
|
||||
|
||||
testImplementation(project(":test-utils"))
|
||||
}
|
||||
|
@ -196,5 +196,5 @@ class AssemblyProblem(
|
||||
@Serializable
|
||||
class Label(
|
||||
val name: Int,
|
||||
val range: AsmRange?,
|
||||
val range: AsmRange,
|
||||
)
|
||||
|
@ -261,31 +261,9 @@ external interface IMonarchLanguageBracket {
|
||||
}
|
||||
|
||||
external interface CompletionItemLabel {
|
||||
/**
|
||||
* The function or variable. Rendered leftmost.
|
||||
*/
|
||||
var name: String
|
||||
|
||||
/**
|
||||
* The signature without the return type. Render after `name`.
|
||||
*/
|
||||
var signature: String?
|
||||
get() = definedExternally
|
||||
set(value) = definedExternally
|
||||
|
||||
/**
|
||||
* The fully qualified name, like package name or file path. Rendered after `signature`.
|
||||
*/
|
||||
var qualifier: String?
|
||||
get() = definedExternally
|
||||
set(value) = definedExternally
|
||||
|
||||
/**
|
||||
* The return-type of a function or type of a property/variable. Rendered rightmost.
|
||||
*/
|
||||
var type: String?
|
||||
get() = definedExternally
|
||||
set(value) = definedExternally
|
||||
var label: String
|
||||
var detail: String?
|
||||
var description: String?
|
||||
}
|
||||
|
||||
external interface CompletionItemRanges {
|
||||
@ -448,7 +426,7 @@ external interface CompletionItem {
|
||||
|
||||
external interface CompletionList {
|
||||
var suggestions: Array<CompletionItem>
|
||||
var incomplete: Boolean
|
||||
var incomplete: Boolean?
|
||||
|
||||
fun dispose()
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ class AsmCompletionItemProvider(private val analyser: AsmAnalyser) :
|
||||
val completion = completions[i]
|
||||
|
||||
obj {
|
||||
label = obj { name = completion.label }
|
||||
label = obj { label = completion.label }
|
||||
kind = when (completion.type) {
|
||||
CompletionItemType.Keyword -> CompletionItemKind.Keyword
|
||||
CompletionItemType.Opcode -> CompletionItemKind.Function
|
||||
|
@ -1,14 +1,16 @@
|
||||
package world.phantasmal.web.questEditor.asm.monaco
|
||||
|
||||
import kotlinx.coroutines.promise
|
||||
import world.phantasmal.web.externals.monacoEditor.CancellationToken
|
||||
import world.phantasmal.web.externals.monacoEditor.DocumentSymbol
|
||||
import world.phantasmal.web.externals.monacoEditor.DocumentSymbolProvider
|
||||
import world.phantasmal.web.externals.monacoEditor.ITextModel
|
||||
import world.phantasmal.web.externals.monacoEditor.*
|
||||
import world.phantasmal.web.questEditor.asm.AsmAnalyser
|
||||
import world.phantasmal.webui.obj
|
||||
import kotlin.js.Promise
|
||||
|
||||
// Sometimes produces stack overflows in monaco perf monitoring code due to a monaco bug. Things
|
||||
// still work as they should, though.
|
||||
// Chrome error: "Uncaught (in promise) RangeError: Maximum call stack size exceeded"
|
||||
// https://github.com/microsoft/monaco-editor/issues/2586
|
||||
// TODO: See whether monaco perf monitoring bug will get fixed or not.
|
||||
class AsmDocumentSymbolProvider(private val asmAnalyser: AsmAnalyser) :
|
||||
MonacoProvider(), DocumentSymbolProvider {
|
||||
override val displayName: String? = null
|
||||
@ -25,7 +27,11 @@ class AsmDocumentSymbolProvider(private val asmAnalyser: AsmAnalyser) :
|
||||
|
||||
obj {
|
||||
name = label.name.toString()
|
||||
label.range?.let { range = it.toIRange() }
|
||||
detail = ""
|
||||
kind = SymbolKind.Function
|
||||
tags = emptyArray()
|
||||
range = label.range.toIRange()
|
||||
selectionRange = range
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user