Markdown OKF-Schema Studio

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)
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
nominalThe editor opens before the render ends
InputOutcome
a first render delayed by two seconds, the file opened with the Studio Open With editorthe 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 oncethe pending page is replaced by the rendered page without any further action
nominalOther previews stay open
InputOutcome
a side preview and the stock Markdown preview open, the same file opened with the Studio Open With editorthe 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 rightthe 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
InputOutcome
a document with a scheme other than file opened with the Studio Open With editorits page shows Preview source missing and the message Markdown OKF-Schema Studio requires a Markdown file.
a saved .md filethe refusal page is not shown and the file renders
refusalA failure while opening
InputOutcome
the creation of the session throws, the editor is resolvedthe page shows a status page Preview unavailable with the error message, in the status region
the session exists and its first render throwsthe session status becomes error with the message, and no exception reaches VS Code

Implemented in 1

Tested by 3