Route a JSON .sldd out of the binary editor instead of throwing - #28
Merged
Merged
Conversation
"Reopen Editor With…" offers a custom editor for every file its selector's filename glob matches, and the two .sldd formats are not distinguishable by name — so the writable binary view is offered for a JSON dictionary too. Its openCustomDocument unzipped unconditionally, so choosing it threw "invalid zip data" before any panel existed: an error notification on a file the default view opens perfectly well (#24). Guard the unzip and hand the file back to dataExplorer.binaryView, which owns the one rule that picks an editor from a .sldd's bytes, rather than deciding "JSON ⇒ the table view" here. That keeps the rule single: a second copy of it would get the over-the-sync-limit dictionary wrong, which the default view deliberately keeps read-only because the text-backed table cannot resolve it at all. Reported by @anna-poplawski. The remaining half of that report — two menu entries sharing the name "Data Explorer (editable)" — is a naming decision and stays open.
This was referenced Sep 19, 2026
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.
Fixes the error half of #24.
What the customer saw
With a
.slddopen, Reopen Editor With… lists three Data Explorer entries, and one of the two named Data Explorer (editable) threw an error when picked.Root cause
BinarySlddEditorProvider.openCustomDocumentcalledunzipSyncunconditionally. A custom editor'sselectoris a filename glob, and the two.slddformats — JSON text and compressed-binary zip — are not distinguishable by name, so this writable binary view is offered for every*.sldd, JSON ones included. On a JSON dictionary the unzip threwinvalid zip data, before any panel existed:Fix
Guard the unzip, and hand the file back to
dataExplorer.binaryView— the default byte-backed view, which already owns the one format-to-editor rule and is what an Explorer double-click goes through.Routing back to the router rather than deciding "JSON ⇒ the table view" locally is deliberate: a second copy of that rule would get the over-50 MB JSON dictionary wrong. The default view keeps that one read-only on purpose, because the text-backed table cannot resolve it at all.
Verification
New integration test in
binarySlddEdit.test.ts, asserting the tab the user actually ends up looking at. It fails onmainfor the right reason —Error: invalid zip data at BinarySlddEditorProvider.openCustomDocument— and passes here.npm run verify— green (2480 unit tests, typecheck, both bundles, leak check)npm run test:integration— 134 passing, 1 pending, 0 failingQualified in real VS Code rather than in the Playwright webview harness: the symptom is editor routing, which the harness (which serves the webview bundle standalone) cannot see, while the integration test drives the real provider and asserts the resulting tab's
viewType.Still open on #24
The menu still lists two entries both named Data Explorer (editable), and picking the text-backed one for a binary
.slddopens a tab VS Code cannot populate (File seems to be binary and cannot be opened as text— our provider is never reached, so it cannot self-correct). That is a naming/contribution decision, captured on the issue with options rather than guessed at here.