How eighthundreds/vscode-drawio works
Project Type and Purpose
• The goal is to let users open, edit, and save “.drawio” (and related) files inside VS Code via a Webview-backed UI.
File Structure Analysis
• Top‐level files: package.json/lock, tsconfig.json, CHANGELOG.md, LICENSE, README.md
• /src: TypeScript extension code
• extension.ts – activates the extension and registers the custom editor provider
• DrawIOEditorProvider.ts – implements the VS Code CustomEditorProvider interface
• logger.ts – central logging utility
• /test – unit/integration tests run against the extension
• /drawioApp: the entire static front-end application
• app.html, index.html, electron.js, etc. – entry points for the web UI
• MathJax integration, Dropbox/GitHub/OneDrive/Trello clients, all packaged in
• Visual Studio Code configuration files (.vscode, .eslintrc.json)
README Insights
• Confirms “custom editor” extension.
• Points to an alternative, implying this is a wrapper rather than a reimplementation.
a. Main Components
1. VS Code Host (Extension Host process)
2. DrawIOEditorProvider (TypeScript)
3. Webview Panel (Chromium‐based UI inside VS Code)
4. Static Asset Store (/drawioApp folder)
5. Local File System / VS Code Workspace FS API
6. External Services (Dropbox, OneDrive, GitHub, etc.—optional front-end connectors)
b. Relationships and Interactions
• VS Code Host ↔ DrawIOEditorProvider: activation, registration of custom editors
• DrawIOEditorProvider ↔ Webview:
– Provider loads app.html into a Webview
– Message passing (postMessage) for “open file,” “save file,” undo/redo notifications
• Webview ↔ External Services: front-end clients (e.g., DropboxClient.js) make HTTP calls
c. Architectural Patterns
• Custom Editor pattern in VS Code: separation of host logic (TypeScript) vs. UI (Webview)
d. Key Technologies
• VS Code Extension API (CustomEditorProvider)
• TypeScript for extension code
• VS Code FS API for file I/O
• Node tooling (npm, webpack or none, tsconfig)