Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | 4x 4x 4x 1x 1x 3x 1x 1x 2x 2x 2x 2x 2x | import * as vscode from "vscode";
import { CanvasPanel } from "../canvas/CanvasPanel";
export function registerSaveCommand(): vscode.Disposable {
return vscode.commands.registerCommand("swingGuiBuilder.save", async () => {
const workspaceFolders = vscode.workspace.workspaceFolders;
if (!workspaceFolders) {
vscode.window.showErrorMessage("No workspace folder open.");
return;
}
if (!CanvasPanel.currentPanel) {
vscode.window.showErrorMessage("No canvas is open. Open a canvas first.");
return;
}
const state = CanvasPanel.currentPanel.getCanvasState();
const filePath = vscode.Uri.joinPath(workspaceFolders[0].uri, ".swingbuilder-layout.json");
const content = Buffer.from(`${JSON.stringify(state, null, 2)}\n`, "utf-8");
await vscode.workspace.fs.writeFile(filePath, content);
vscode.window.showInformationMessage("Canvas saved to .swingbuilder-layout.json");
});
}
|