Behaviour SwRS-MDOKFSTUDIO-LIFE-195
The editor association of Markdown files is restored once from the retired Studio setting
When the extension activates and the user or the workspace settings hold the retired setting open.markdownFilesInStudio turned on, the extension SHALL write the workbench.editorAssociations entry *.md naming the Studio editor in that scope before it removes the retired setting from that scope, leave every other entry untouched, remove the leftover retired settings, and show nothing to the reader.
Step 1 of path 3 in StRS-MDOKFSTUDIO-LIFE-023: from “The reader's user or workspace settings hold the retired setting Open Markdown files in Studio, on” to “The reader's Markdown files open in Studio through the association of VS Code”.
Scenarios 2
The situations the tests check; open one to read it.
nominalA user setting is turned into the association
Giventhe user settings hold open.markdownFilesInStudio on and open.searchResultsInStudio, and workbench.editorAssociations with *.png naming another editor
Whenthe extension activates
Thenthe user settings hold workbench.editorAssociations with *.png kept and *.md naming the Studio editor, neither retired setting is left, and nothing is shown to the reader
boundaryWhat is written and what is not
| Input | Outcome |
|---|---|
| no association in the scope | the association becomes the single entry *.md for the Studio editor |
| an association object without *.md | the entry is added after the others, which keep their order |
| the legacy array form with no *.md item | the item with the Studio view type and the pattern *.md is appended |
| *.md already names the Studio editor, or another editor | nothing is written to the association, the other editor stays, and the retired setting is still removed |
| the user scope and the workspace scope both hold the setting on | each scope gets the association and loses its setting; a workspace that held it off while the user held it on only loses its value, so the user association then applies in that workspace |
| a setting that is off, or open.searchResultsInStudio whatever its value | no association is written and the value is removed from that scope |
| the setting is off in every scope, or was never stored | nothing is written at all |
| the association write fails | the retired setting stays in that scope, the failure is logged, nothing is shown, the other scope still restores, and the next activation tries again |
| the association has any other shape, not an object nor an array | nothing is written there, the retired setting of that scope stays, the cause is logged and nothing is shown |
| a second activation | nothing is written, because the retired setting is the only mark |
| the store keys markdownOkfSchemaStudio.migrations.editorAssociation of an older version | removed from the global and the workspace state when they exist |
| a host without the setting writer | nothing happens |
| any key other than the Studio settings and workbench.editorAssociations, or a markdown.preview setting | the host writer refuses it without writing |
Implemented in 2
Tested by 5
Replaces
SwRS-MDOKFSTUDIO-LIFE-175The editor association of Markdown files is migrated to the Studio setting once per scope superseded superseded by SwRS-MDOKFSTUDIO-LIFE-195 Markdown file