Menu

Post image 1
Post image 2
Post image 3
Post image 4
1 / 4
0

Building a Universal Drafts System in a VS Code Extension — Part 1: Types & Storage

DEV Community·freerave·about 1 month ago
#RiESezTf
Reading 0:00
15s threshold

How I designed the Draft type, DraftsService, and the save/upsert flow that powers DotShare v3.2.5 — with full TypeScript code and the decisions behind every choice. Before v3.2.5, DotShare had zero persistence. Write a 2,000-word Dev.to article in the WebView, switch tabs to check something, come back — gone. Reset. Empty form. So I built a drafts system. This is Part 1: how I modeled the data and built the storage layer. Part 2 covers the Two-Way Markdown Sync, Remote Dev.to Drafts, the WebView UI, and the Split-Editor workflow. The Problem with WebViews VS Code WebViews are iframes. They get suspended when not visible and fully reset on restart. For a tweet that's annoying. For a structured blog article with frontmatter, tags, cover image, and thousands of words — it's a real productivity loss. The naive fix is "just auto-save to a file." But that creates new questions: which file? What about social posts that have no file? What if the user has multiple articles open?…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.

Read More