Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"icon": "resources/icon.png",
"pricing": "Free",
"publisher": "DaanV2",
"version": "1.0.0",
"version": "1.0.1",
"author": {
"name": "DaanV2"
},
Expand Down
36 changes: 8 additions & 28 deletions src/view/webview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { filename } from "../format";
import { getFunctions } from "../go/dependencies";
import { matchesSourceFile, SourceFileMatchTarget } from "./sourceMatch";
import { createSourceMatchTarget } from "./sourceMatchTarget";
import { getHtml, getHtmlAssembly } from "./webviewHtml";
import { getShellHtml, getAsmContentHtml } from "./webviewHtml";

/**
* Finds the best matching source editor for the given source file.
Expand Down Expand Up @@ -74,14 +74,8 @@ export class AssemblyView implements Disposable {
ViewColumn.Beside,
{ enableScripts: true },
);
this.panel.webview.html = "loading...";
getHtml("loading...", "", new Map(), this.sourceMatchTarget).then(
(html) => {
if (this.panel.webview.html === "loading...") {
this.panel.webview.html = html;
}
},
);
// Set the shell once — all subsequent assembly updates go through postMessage
this.panel.webview.html = getShellHtml(this.filename);

// Handle messages from the webview (ASM hover → source highlight)
this._disposables.push(
Expand Down Expand Up @@ -142,12 +136,7 @@ export class AssemblyView implements Disposable {
return;
}
const errDetail = err instanceof Error ? err.message : JSON.stringify(err, undefined, 2);
this.panel.webview.html = await getHtml(
`got an error: ${errDetail}`,
this.filename,
new Map(),
this.sourceMatchTarget,
);
void this.panel.webview.postMessage({ type: "updateStatus", message: `Error: ${errDetail}` });
}
}

Expand All @@ -157,27 +146,18 @@ export class AssemblyView implements Disposable {
try {
const funcs = await getFunctions(this.fileUri);
const prioritized = prioritizeAssemblyBlocks(this._asmContainer.blocks, funcs);
this._asmContainer.rebuildMaps(prioritized, (file) => matchesSourceFile(file, this.sourceMatchTarget));

let b = prioritized;
if (b.length > 1000) {
b = b.slice(0, 1000);
}
this._asmContainer.rebuildMaps(b, (file) => matchesSourceFile(file, this.sourceMatchTarget));

this.panel.webview.html = await getHtmlAssembly(
b,
this.filename,
this._asmContainer.lineToSource,
this.sourceMatchTarget,
);
const html = getAsmContentHtml(b, this._asmContainer.lineToSource, this.sourceMatchTarget);
void this.panel.webview.postMessage({ type: "updateAsm", html });
} catch (err: unknown) {
const errDetail = err instanceof Error ? err.message : JSON.stringify(err, undefined, 2);
this.panel.webview.html = await getHtml(
`got an error: ${errDetail}`,
this.filename,
new Map(),
this.sourceMatchTarget,
);
void this.panel.webview.postMessage({ type: "updateStatus", message: `Error: ${errDetail}` });
}
}

Expand Down
Loading
Loading