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
the restore completes once the page shows the rendered document (by reading deserializePreviewPanel, which awaits requestDocument)
boundaryFile outside a folder
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 state | Message shown |
|---|---|
| No saved state at all | The previous preview identity could not be restored safely. |
| A saved document id that is an empty string | The previous preview identity could not be restored safely. |
| A saved document id that Uri.parse rejects | The 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-source | The restored Markdown source is unavailable. |
| A saved document id that parses | No message: the restore continues to the next checks |
| The missing file is created later | The preview renders it by itself (see SwRS-MDOKFSTUDIO-LIFE-062) |
nominalA restored side preview owns its group lock
boundaryOlder panel after a newer restore
boundaryIdentity of a saved state
| Saved state | Outcome |
|---|---|
| An object with a non-empty documentId and a non-empty sourceFile | The state is returned with the identity |
| Not an object | Nothing is returned |
| An empty or non-string documentId | Nothing is returned |
| An empty or non-string sourceFile | Nothing is returned |
boundaryOptional fields of a saved state
The identity is kept in every row.
| Saved field | Kept | Dropped or cut |
|---|---|---|
| sourceLine | a positive integer (12) | 0 |
| scrollTop | a non-negative finite number (88.5) | -1 |
| open-section indexes | at 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 id | at most 200 characters | 201 characters |
| selected text | at most 4096 characters | 4097 characters |
| descriptionsCollapsed | a boolean (true) | any other value, such as the string yes |