Markdown OKF-Schema Studio

Behaviour SwRS-MDOKFSTUDIO-BLOCK-058

Every host source edit is one undo step, renders once and reports a failed apply

When the host writes an edit of the source document for the preview, it SHALL make the edit one undo step, refresh the preview once for it, and answer an edit that VS Code does not apply or rejects with a reason that begins "VS Code could not apply" or with the text of the error.

Step 2 of path 1 in StRS-MDOKFSTUDIO-BLOCK-025: from “The typed text is in the document” to “The edit is one undo step with the line endings kept”.

Scenarios 8

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

nominalOne undo step per edit kind
Edit kindHow it is writtenOne Undo restores
Text of a block editor session (several autosaves and the final save)Plain document edits without undo stops of their own, merged by VS CodeThe block as it was before the session
Block moveOwn undo stops in the text editor that shows the documentThe previous order of the blocks
Block cutOwn undo stops in the text editor that shows the documentThe blocks that were cut
Block pasteOwn undo stops in the text editor that shows the documentThe document before the paste
Checkbox toggleOwn undo stops in the text editor that shows the documentThe original source
Reply to an inline threadOwn undo stops in the text editor that shows the documentThe document as before the reply
Delete of an inline threadOwn undo stops in the text editor that shows the documentThe thread is back
Frontmatter save (value save, add, rename, remove)Exactly one text edit passed to the documentThe document to its text before the save
Label renameOwn undo stops in the text editor that shows the documentThe document before the rename
nominalCancelled session
Givenan autosaved block edit that was cancelled
Whenthe host restores the original text
Thenthe restore is itself an ordinary edit
nominalNo visible text editor
Givena document shown only in the preview, with no text editor showing it
Whena move, a cut, a paste or a checkbox toggle is applied
Thenthe edit is applied as a workspace edit, one undoable step, with no undo stops of its own
nominalOne render after the final save
Givena block edit whose autosave changed the document and a final save with the same text
Whenthe final save completes
Thenthe preview is refreshed once, with the pin of the save
boundaryNothing applied
Givena held edit for which no autosave changed the document
Whenits final save carries the original text
Thenno render is started
refusalAn edit that VS Code does not apply or rejects
Edit kindVS Code does not apply the editVS Code rejects the edit or a clipboard access failsHeld edit
Block save (autosave or final save)The editor shows "VS Code could not apply the Markdown edit." and the final request is resetThe editor shows the text of the errorKept for a new save
Block moveAnswer ok false with "VS Code could not apply the move."Answer ok false with the text of the errorNone
Block cutAnswer ok false with "VS Code could not apply the cut."Answer ok false with the text of the errorNone
Block pasteAnswer ok false with "VS Code could not apply the paste."Answer ok false with the text of the errorNone
Block copyNot applicable, nothing is writtenA failing clipboard write answers ok false with the text of the errorNone
Checkbox toggleAnswer with the error "VS Code could not apply the checkbox edit."Answer with the text of the errorNone
Label renameAnswer ok false with "VS Code could not apply the rename."Answer ok false with the text of the errorNone
Reply or delete of an inline threadAnswer ok false with "VS Code could not apply the change."Answer ok false with the message of the errorNone
Frontmatter saveAnswer "VS Code could not apply the frontmatter edit."Answer with the error message textThe document stays unchanged and the editor stays open with the message
refusalA block that changed under the host
Givenan autosave to write and a block whose text was changed in the document meanwhile
Whenthe host is about to write
Thenthe editor shows "The source block changed while it was being edited." and the lock is released while the editor stays open
boundaryA block that did not change
Giventhe block still equals the last written text
Whenthe host writes
Thenthe replacement is applied

Implemented in 3

Tested by 8

Replaces

SwRS-MDOKFSTUDIO-FMEDIT-053A save VS Code rejects is reported superseded superseded by SwRS-MDOKFSTUDIO-BLOCK-058 Markdown file
SwRS-MDOKFSTUDIO-FMEDIT-055Each frontmatter save is one document edit superseded superseded by SwRS-MDOKFSTUDIO-BLOCK-058 Markdown file
SwRS-MDOKFSTUDIO-GFM-022A checkbox toggle is one undo step superseded superseded by SwRS-MDOKFSTUDIO-BLOCK-058 Markdown file