Skip to content

Feature/Positron Editor Action Bar integration for Source / Visual toggle and [X] Render on Save checkbox #698

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
Apr 18, 2025

Conversation

softwarenerd
Copy link
Contributor

This PR updates the Quarto extension so that it places two new controls on the Positron Editor Action Bar. Those controls are:

  • A toggle switch for changing between Source and Visual editing mode.
  • A checkbox to enable or disable Render on Save for the current editing session.

Here's a video that shows these controls in action:

Screen.Recording.2025-04-16.at.3.19.55.PM.mov

The Source / Visual toggle control is quite straightforward.

The Render on Save checkbox control appears when a Quarto or Quarto Shiny document is open and it allows the user to independently override the configuration settings for Quarto > Render: Render on Save and Quarto > Render: Render on Save Shiny, depending on the document type, in the current editing session.

Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 5 out of 7 changed files in this pull request and generated no comments.

Files not reviewed (2)
  • apps/vscode/package.json: Language not supported
  • package.json: Language not supported

Copy link
Collaborator

@juliasilge juliasilge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is looking great! 🙌 Thank you so much for taking a look at how this plays out over in extension land.

With the change I made in 53a50e0, this PR now closes #692. ✅

I want to highlight that there is some existing behavior that was already bad that now feels a bit worse, with the toggle between source and visual mode so prominently displayed now. If you have a document that specifies editor: visual in the YAML front matter and you are currently editing in visual mode, using any of our affordances to switch back to source editing does not work; you stay in visual mode. RStudio behaves in what I would consider the correct way; in this situation, if you switch the toggle, the editor switches to source mode. Do you think any of this new work could be used to fix that in this PR? Or should we open a followup issue to make that better?

@juliasilge
Copy link
Collaborator

juliasilge commented Apr 17, 2025

One other question for you @softwarenerd: If I open a Quarto file for the first time, the "Preview" button with its label shows up immediately, but the other two new controls take ~5 sec to show up. Is there anything we can do about that?

action-bar.mov

@juliasilge
Copy link
Collaborator

I installed the .vsix from this PR into VS Code and everything looks as expected (i.e. no changes from here leaking through):

Screenshot 2025-04-16 at 7 36 47 PM

@softwarenerd
Copy link
Contributor Author

One other question for you @softwarenerd: If I open a Quarto file for the first time, the "Preview" button with its label shows up immediately, but the other two new controls take ~5 sec to show up. Is there anything we can do about that?

I will continue to look into this. From everything I know at this point, this delay may be inherent in the startup of the extension. We draw these new components on the Editor Action Bar the moment they show up in React-land with a context key expression we can evaluate so we can determine how to draw them.

@softwarenerd
Copy link
Contributor Author

This is looking great! 🙌 Thank you so much for taking a look at how this plays out over in extension land.

With the change I made in 53a50e0, this PR now closes #692. ✅

I want to highlight that there is some existing behavior that was already bad that now feels a bit worse, with the toggle between source and visual mode so prominently displayed now. If you have a document that specifies editor: visual in the YAML front matter and you are currently editing in visual mode, using any of our affordances to switch back to source editing does not work; you stay in visual mode. RStudio behaves in what I would consider the correct way; in this situation, if you switch the toggle, the editor switches to source mode. Do you think any of this new work could be used to fix that in this PR? Or should we open a followup issue to make that better?

I will look into this. I wasn't aware of the editor: visual front matter setting (this was my first time messing with the Quarto extension), so I didn't test this scenario.

If the editor: visual front matter works the way the render-on-save: true front matter works, it supersedes everything. So this may be why none of our affordances for switching back to source editing work. I'll review and report back.

…ub.com:quarto-dev/quarto into feature/positron-editor-action-bar-integration
Copy link
Collaborator

@juliasilge juliasilge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to go! I'll double check we open followup issues on:

  • switching from visual mode when you are in visual mode
  • the new UI arriving later than the "Preview" button

@juliasilge
Copy link
Collaborator

I opened posit-dev/positron#7304 to explore further improvements in how these new UI affordances show up.

@juliasilge
Copy link
Collaborator

I opened posit-dev/positron#7305 for us to resolve the problem around switching to source mode if you are in visual mode.

@softwarenerd softwarenerd merged commit 4eb1464 into main Apr 18, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants