Skip to content

Commit a991d0e

Browse files
committed
feat: show objects in editor
1 parent a32e778 commit a991d0e

17 files changed

Lines changed: 425 additions & 285 deletions

.vscode/launch.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"type": "extensionHost",
77
"request": "launch",
88
"runtimeExecutable": "${execPath}",
9-
"args": ["--extensionDevelopmentPath=${workspaceRoot}"],
9+
"args": ["--extensionDevelopmentPath=${workspaceRoot}/editor"],
1010
"outFiles": ["${workspaceFolder}/editor/out/**/*.js"],
1111
"preLaunchTask": "Build"
1212
}

deno.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
"clear-spawns": "deno -A tools/modify_map_clear_spawns.ts block_0.0 block_-200.0 block_0.-200 block_-200.-200 block_-200.200 block_0.200 block_not_found",
1212
"add-spawns": "deno -A tools/modify_map_add_spawns_randomly.ts block_0.0 block_-200.0 block_0.-200 block_-200.-200 block_-200.200 block_0.200 block_not_found",
1313
"dist": "deno run -A npm:cpx2 'out/**' dist",
14-
"serve": "deno run -A jsr:@std/http/file-server out -p 8000"
14+
"serve": "deno run -A jsr:@std/http/file-server out -p 8000",
15+
"update-editor": "deno task --cwd editor update-package"
1516
},
1617
"compilerOptions": {
1718
"lib": ["deno.ns", "esnext", "dom", "dom.iterable"]

editor/extension.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ function resolveCustomTextEditor(
3939
<div class="toolbox fixed left-0 top-0 flex items-center gap-2 bg-neutral-900/50 w-full">
4040
<div class="cell-switch flex items-center relative">
4141
</div>
42+
<div class="h-full w-0 border-l border-neutral-500">&nbsp;</div>
43+
<div class="object-switch flex items-center relative">
44+
</div>
4245
<div class="group relative">
4346
<span class="mode-switch">dot</span>
4447
<span class="
@@ -60,7 +63,6 @@ function resolveCustomTextEditor(
6063
const sub = workspace.onDidChangeTextDocument(onDocChange)
6164
panel.onDidDispose(() => sub.dispose())
6265
webview.onDidReceiveMessage(onMessage)
63-
updateWebview()
6466

6567
function postMessage(message: type.Extension.Message) {
6668
webview.postMessage(message)
@@ -81,6 +83,9 @@ function resolveCustomTextEditor(
8183

8284
function onMessage(e: type.Webview.Message) {
8385
switch (e.type) {
86+
case "ready":
87+
updateWebview()
88+
break
8489
case "update":
8590
update(e)
8691
break

editor/types.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ export namespace Extension {
2929

3030
// deno-lint-ignore no-namespace
3131
export namespace Webview {
32+
export type MessageReady = {
33+
type: "ready"
34+
}
3235
export type MessageLoadImage = {
3336
type: "loadImage"
3437
id: string
@@ -44,5 +47,9 @@ export namespace Webview {
4447
// deno-lint-ignore no-explicit-any
4548
map: any
4649
}
47-
export type Message = MessageLoadImage | MessageLoadText | MessageUpdate
50+
export type Message =
51+
| MessageLoadImage
52+
| MessageLoadText
53+
| MessageUpdate
54+
| MessageReady
4855
}
909 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)