Behaviour SwRS-MDOKFSTUDIO-LIFE-018
The Open With editor shows its own Markdown file
When a reader opens a .md file with the optional Markdown OKF-Schema Studio editor through Open With, the extension SHALL resolve the editor at once and show that file in a tab that keeps showing it whatever editor becomes active, leave the other previews open, and show a page that names the refusal or the failure when the document is not a saved .md file or the preview cannot be created.
Step 1 of path 2 in StRS-MDOKFSTUDIO-LIFE-001: from “A saved Markdown file is the active editor” to “The file is shown in a Studio tab”.
Scenarios 6
The situations the tests check; open one to read it.
nominalDeclared editor
Giventhe package manifest
Whenthe custom editors are read
Thenone editor has the view type markdown-okf-schema-studio.editor, the display name Markdown OKF-Schema Studio, the selector *.md and the priority option
a .md file opened with a double click opens in the text editor, never in the Studio (priority option; deduced from VS Code behaviour, not run)
a .md file opened with a double click opens in the text editor, never in the Studio (priority option; deduced from VS Code behaviour, not run)
nominalThe tab shows its own file
Givenpreview.md open in a text editor
Whenthe reader runs Open With and chooses Markdown OKF-Schema Studio
Thenthe tab shows the rendered preview.md and its title is the bare file name preview.md (integration test test/integration/stockCoexistence.test.ts, the optional MyST Open With editor)
when a text editor of preview-other.md becomes active, the Open With tab keeps showing preview.md
when a text editor of preview-other.md becomes active, the Open With tab keeps showing preview.md
nominalThe editor opens before the render ends
| Input | Outcome |
|---|---|
| a first render delayed by two seconds, the file opened with the Studio Open With editor | the open call returns within one second with a pending status page (Preview pending), and the rendered view appears when the render ends (integration test test/integration/stockCoexistence.test.ts) |
| a render that ends at once | the pending page is replaced by the rendered page without any further action |
nominalOther previews stay open
| Input | Outcome |
|---|---|
| a side preview and the stock Markdown preview open, the same file opened with the Studio Open With editor | the side preview is not disposed and the Open With tab is active (integration test test/integration/stockCoexistence.test.ts) |
| the Open With tab split to the right | the original tab stays, the side preview is not disposed and the active preview still shows the document |
refusalA document that is not a saved Markdown file
| Input | Outcome |
|---|---|
| a document with a scheme other than file opened with the Studio Open With editor | its page shows Preview source missing and the message Markdown OKF-Schema Studio requires a Markdown file. |
| a saved .md file | the refusal page is not shown and the file renders |
refusalA failure while opening
| Input | Outcome |
|---|---|
| the creation of the session throws, the editor is resolved | the page shows a status page Preview unavailable with the error message, in the status region |
| the session exists and its first render throws | the session status becomes error with the message, and no exception reaches VS Code |