This is a cleaned-up skeleton based on your current codebase.
- All references to the Microsoft catScratch / catCustoms sample.
- The huge sample HTML (GrapesJS demo) and commented dead code.
- The repeated
panel.webview.html = htmlassignments. - Multiple duplicated
onDidReceiveMessagehandlers. - Reveal / focus timer storms that were causing Webview is disposed errors.
- Preview panel (reliable): command
Delphine: Open Preview Panel - Custom editor (optional): viewType
delphine.previewEditorwithpriority: option- Use Open With… on an
.htmlfile to choose it.
- Use Open With… on an
src/extension.ts— registers commands + custom editor providersrc/preview/PreviewPanel.ts— webview panel (separate from custom editor)src/preview/html.ts— HTML builder + CSP (nonce + webview.cspSource)src/editor/DelphineEditorProvider.ts— optional custom editor provider
The preview HTML expects these files in your extension folder:
media/boot.jsmedia/zaza.compiled.js
If you want to load scripts from somewhere else (workspace folder, generated output, etc.), change the URIs in src/preview/html.ts.
npm install
npm run compileThen run the extension in VS Code (F5).