quarto-dev / quarto-dev/quarto

`editor: visual` in frontmatter causes issues with source/visual mode switch in Positron

Open
#805 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

bug vscode
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:

  1. 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)

  2. When editor: visual is 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

  1. Create a quarto document that has editor: visual in the YAML frontmatter of the document
  2. Save the file
  3. Click the "Preview" button in the Editor Actions bar
  4. 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:

  1. 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: visual is in the frontmatter?
  • or, note to the user that they could can editor: visual from the frontmatter to avoid this
  1. When editor: visual is 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: visual must 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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.