feat(library): add source-preserving JSON tree editing - #167
Merged
PPRAMANIK62 merged 5 commits intoAug 14, 2026
Conversation
Swapnanilmanna1701
marked this pull request as ready for review
August 13, 2026 21:08
PPRAMANIK62
force-pushed
the
swapnanil/json-tree-editing
branch
from
August 14, 2026 07:13
51946e8 to
7300fb9
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #166 by adding a lazy, source-preserving Tree mode for strict JSON while retaining the existing exact Source editor and shared versioned save transaction.
JSON source text remains the only persistence authority. The tree is a bounded controller over syntax spans: supported structural operations patch the smallest safe source range instead of parsing into a JavaScript object and serializing the full document.
What changed
Source-preservation details
The StashBase-owned source model uses strict
jsonc-parsersyntax trees without materializing a normal JavaScript object. This avoids duplicate-key collapse and unsafe-number coercion. Existing syntax is retained byte-for-byte except for the selected safe range. First-child insertion replaces existing empty-container whitespace, so multiline{\n}/[\n]containers do not acquire blank lines and indented closing delimiters remain aligned.Documents with duplicate object keys do not enter Tree mode because ordinary path identity cannot distinguish those members safely. They remain fully usable in Source mode.
Validation
pnpm typecheckpnpm build:webpnpm test:rendererpnpm test:renderer-chunkspnpm test:library-filespnpm test:retrievalpnpm test:docspnpm test:e2e:check-focuspnpm test:e2e:smoke— 5 passedmarkdown-json.spec.tsElectron functional journey passedReviewer notes