quarto-dev / quarto-dev/quarto
`editor: visual` in frontmatter causes issues with source/visual mode switch in Positron
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 645
- Forks
- 62
- Avg merge
- 17h 42m
- Merged PRs (30d)
- 13
Description
Bug description
In Positron, if you have not previously used the Quarto Visual Editor (e.g. in a fresh environment where Positron doesn't have user state yet), specifying editor: visual in the frontmatter of a Quarto document can result in a couple awkward UI experiences:
-
The first time you "Preview" the document, you get this modal, which is un-cancellable (clicking Cancel seems to cause the editor to reopen and trigger the modal again)
-
When
editor: visualis specified and you try to toggle back to Source mode using the toggle in the Editor Actions, you get kicked back to Visual mode after a similar editor reopen (~1:15 in the video)
https://github.com/user-attachments/assets/33b4a756-58d6-4d83-a1b3-71bc0d2f2ba3
Steps to reproduce
PRE-REQ: a fresh Positron installation with no existing Quarto extension state
- Create a quarto document that has
editor: visualin the YAML frontmatter of the document - Save the file
- Click the "Preview" button in the Editor Actions bar
- See the modal as described above
Quarto code for the modal: https://github.com/quarto-dev/quarto/blob/3fe790b2d85e86694a71fdad172f785f2ee90531/apps/vscode/src/providers/editor/editor.ts#L363-L387
Actual behavior
No response
Expected behavior
Some ideas for expected behaviour:
- The first time you "Preview" the document, you get this modal, which is un-cancellable (clicking Cancel seems to cause the editor to reopen and trigger the modal again)
- When Cancel is clicked, the user should be allowed back to Source mode, even though
editor: visualis in the frontmatter? - or, note to the user that they could can
editor: visualfrom the frontmatter to avoid this
- When
editor: visualis specified and you try to toggle back to Source mode using the toggle in the Editor Actions, you get kicked back to Visual mode
editor: <MODE>should set the default mode when the editor for the file is first opened, but if the user manually toggles to a different mode, they should be able to?- or, note to the user that
editor: visualmust be removed if they want to switch to source?
Your environment
See https://github.com/posit-dev/positron/issues/9268 for additional context and environments.
This is 100% reproducible in a fresh demo environment in Workbench. For Desktop builds, I think a state reset is needed before reproducing, as the problem is no longer reproducible once the user has clicked Use Visual Mode in the modal.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with apps/vscode/src/providers/editor/editor.ts around lines 363-387, then reproduce the modal and source/visual toggle behavior in a fresh Positron or Workbench environment. Review issue 9268 for the referenced environment context. Done means Cancel no longer traps the user and manually selecting Source mode is not immediately overridden by editor: visual, with the intended behavior confirmed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100