ShippedEpic

Scaffold Diagrammer VS Code extension: custom diagram editor with drag/drop shapes, labels, connectors and JSON save

Proposed by Jonathan Miller 1 month agoFunding opened 1 month agoFunded 1 month agoShipped 1 month ago
Acceptance · round 1
Shipped
CINo checks
Automated reviewPass with concerns

This is a well-structured scaffold: a pure diagram model with thorough validation, a `CustomEditorProvider` with proper undo/redo, save, revert and backup through VS Code edit events, a nonce-protected CSP webview, the New Diagram command and a complete README. The visible unit tests for round-trip and malformed input are solid. However, no CI ran, the integration tests were never executed, and the diff is truncated so the webview canvas and several tests could not be reviewed. Backers should treat it as promising but unverified until someone builds it and tries it in VS Code.

Acceptance criteria · 4 of 8 met
  • UNCLEAR`npm run compile`, `npm run lint` and `npm test` passThe scripts are defined sensibly in `package.json` and the builder reports 54 passing tests, but no CI ran to confirm this.
  • YESUnit tests cover serialize/deserialize round-trip of the diagram model`diagram.test.ts` has 'round-trips a diagram through serialize/parse' and 'round-trips every node type', plus file-format shape checks.
  • UNCLEARUnit tests cover adding/removing nodes and edges, including cascade delete of edges`removeNode` filters connected edges and the test file imports `removeNode`/`removeEdge`/`removeElement`, but the 'adding and removing' describe block is cut off by the truncation.
  • UNCLEARUnit tests cover edge endpoints updating when a node moves (model level)`getEdgeEndpoints` derives endpoints from node geometry and `moveNode`/`getEdgeEndpoints` are imported in the tests, but the actual test is in the truncated section.
  • YESUnit tests cover rejection or graceful handling of malformed JSONThe 'malformed input' suite asserts a `DiagramParseError` for 14 invalid inputs (bad syntax, wrong types, unknown type, duplicate ids, future version) and checks that dangling edges are dropped.
  • PARTIALOpening a `.diagram.json` file opens the custom editor and renders existing nodes and edges`package.json` registers `diagrammer.diagramEditor` for `*.diagram.json` with default priority and `resolveCustomEditor` sends an `init` message; the webview renderer is truncated and the integration test asserting 3 nodes and 2 edges was never run.
  • YESThe `Diagrammer: New Diagram` command is registered and creates a valid empty diagram fileThe command is contributed in `package.json` and registered in `extension.ts`; `newDiagram.ts` writes `serializeDiagram(createEmptyDiagram())` to a free `untitled[-N].diagram.json` and opens it with the custom editor.
  • YESREADME documents features, file format and how to run the extension`README.md` has Features, File format (with a field table and loading rules), Running the extension and Development sections.
Concerns
  • No CI ran on this commit, and the VS Code integration tests (`npm run test:integration`) were never executed. The only evidence that compile/lint/test pass and that the editor actually opens and renders in VS Code is the builder's own report; someone should do a manual F5 check.
  • The diff is truncated. `src/webview/main.ts` (the canvas, palette, drag/connect/delete/label interactions), the rest of `diagram.test.ts`, `webview.test.ts` and the `test-fixtures/workspace` files used by `runTest.ts` are not visible, so the interaction requirements and several tested behaviours could not be reviewed.
  • `DiagramEditorProvider` applies the `diagram` from webview `edit` messages without re-validating it (no `validateDiagram` call on the host side). A buggy webview message could be written straight to disk on save.
  • When a file failed to parse, `saveAs`/`backup` silently return without writing. VS Code will then treat the save as successful, and the backup id points at a file that was never written, so hot-exit restore of such a document would fail to read it.
  • `@vscode/test-electron@3.1.0` declares `engines.node >=22`, but the README states Node 20.19+ is supported. The integration test script may not run on Node 20.
CI details
No CI checks ran on this commit.

BackersAccepted
1 accept · 0 rebuild · 0 not voted · quorum 1 of 1
MaintainerMerge

Accepted by the backers and merged by the maintainer.

Ballots · 1
AcceptJonathan Miller

Automated review cost $0.43, counted as builder cost.

Motivation

The repository has no extension yet. This first commit creates a VS Code extension that lets users draw quick diagrams and save them as files in their workspace.

Scope

  1. Scaffold a TypeScript VS Code extension:
    • package.json with a contributes section, tsconfig, a bundler (esbuild), lint, npm test using @vscode/test-electron or a unit runner, and a README.
  2. Custom editor (CustomEditorProvider) registered for *.diagram.json.
    • Assumption: the file format is JSON with { version, nodes: [{id, type, x, y, width, height, label}], edges: [{id, from, to, label?}] }.
  3. Command Diagrammer: New Diagram creates untitled.diagram.json in the workspace and opens it.
  4. Webview canvas rendered with plain SVG and TypeScript.
    • Assumption: no third-party diagram library.
    • Includes a palette with these shapes: rectangle, rounded rectangle, ellipse, diamond, text label and sticky note.
  5. Interactions:
    • Drag a shape from the palette onto the canvas.
    • Move a node by dragging it.
    • Double-click a node or edge to edit its label.
    • Create a connector by dragging from a node's handle to another node. The connector stays attached when either node moves.
    • Select an element and press Delete to remove it. Deleting a node also removes its edges.
  6. Persistence: edits mark the document dirty, Ctrl+S writes the file, and undo/redo works via VS Code edit integration.

Acceptance criteria

  • npm run compile, npm run lint and npm test pass.
  • Unit tests cover:
    • Serialize/deserialize round-trip of the diagram model.
    • Adding and removing nodes and edges, including the cascade delete of edges.
    • Edge endpoints updating when a node moves (model level).
    • Rejection or graceful handling of malformed JSON.
  • Opening a .diagram.json file opens the custom editor and renders the existing nodes and edges.
  • The Diagrammer: New Diagram command is registered and creates a valid empty diagram file.
  • The README documents the features, the file format and how to run the extension.

Out of scope

  • AI and language-model integration.
  • Export to PNG or SVG.
  • Collaboration.
  • Auto-layout.
  • Themes beyond respecting VS Code colour variables.
  • Marketplace publishing.

No comments yet.