Markdown OKF-Schema Studio

Behaviour SwRS-MDOKFSTUDIO-LIFE-127

A restored panel reopens its document or explains why it cannot

When VS Code restores a Studio preview panel, the extension SHALL open in it the Markdown file its saved state names, with the saved reading position, open sections and Description column state, or show the status Preview source missing with the reason the panel cannot be restored.

Step 1 of path 1 in StRS-MDOKFSTUDIO-LIFE-014: from “A preview was open when VS Code restored its panel” to “The panel shows the file at its saved place”.

Another outcome at step 1 of path 2 in StRS-MDOKFSTUDIO-LIFE-007, in the state “The Markdown file of a preview is missing”.

Part of StRS-MDOKFSTUDIO-LIFE-001, outside the paths drawn on its map.

Scenarios 7

The situations the tests check; open one to read it.

nominalRestore of a saved reading place
Givena saved state with documentId, sourceFile, sourceLine 4, scrollTop 88 and descriptionsCollapsed true
WhenVS Code restores the panel
Thenthe panel renders the file, the session state holds sourceLine 4 and scrollTop 88 and the boot context holds descriptionsCollapsed true
the restore completes once the page shows the rendered document (by reading deserializePreviewPanel, which awaits requestDocument)
boundaryFile outside a folder
Givena saved file that lies in no workspace folder
WhenVS Code restores the panel
Thenthe panel renders it with restricted reads (see SwRS-MDOKFSTUDIO-TRUST-001 and SwRS-MDOKFSTUDIO-TRUST-007)
refusalA saved state that cannot be restored

The page shows the status Preview source missing with the message of the row, and no session is created for the first five rows.

Saved stateMessage shown
No saved state at allThe previous preview identity could not be restored safely.
A saved document id that is an empty stringThe previous preview identity could not be restored safely.
A saved document id that Uri.parse rejectsThe previous preview source URI is invalid.
A saved source notes.txt (extension other than .md)The previous preview source is not a Markdown file.
A saved source whose URI scheme is untitled (not a file URI)The previous preview source is not a Markdown file.
A saved Markdown file that no longer exists (missing-restored.md): the session status is missing-sourceThe restored Markdown source is unavailable.
A saved document id that parsesNo message: the restore continues to the next checks
The missing file is created laterThe preview renders it by itself (see SwRS-MDOKFSTUDIO-LIFE-062)
nominalA restored side preview owns its group lock
Givena restored side preview in group two, which follows the active editor
Whenthe reader closes it
Thenthe extension recorded the panel's group as the group it locked, so the lock of the group is released like that of a preview opened by the command
boundaryOlder panel after a newer restore
Givena restored side preview in group two and a second panel restored later in group three
Whenthe second panel is restored
Thenthe older preview becomes a fixed preview and keeps the group it recorded; every restored panel follows the active editor at the moment it is restored, so each records its group
boundaryIdentity of a saved state
Saved stateOutcome
An object with a non-empty documentId and a non-empty sourceFileThe state is returned with the identity
Not an objectNothing is returned
An empty or non-string documentIdNothing is returned
An empty or non-string sourceFileNothing is returned
boundaryOptional fields of a saved state

The identity is kept in every row.

Saved fieldKeptDropped or cut
sourceLinea positive integer (12)0
scrollTopa non-negative finite number (88.5)-1
open-section indexesat most 100 indexes from 0 to 9999 (0, 3 and 9999)an index of 10000; with 101 valid indexes, only the first 100 are kept
focused block idat most 200 characters201 characters
selected textat most 4096 characters4097 characters
descriptionsCollapseda boolean (true)any other value, such as the string yes

Implemented in 2

Tested by 3