Open DavisVaughan opened 1 month ago
This sort of already exists, since the Quarto extension provides the visual editor editor with "priority": "option"
:
This quick pick pops up if you ever right click on a .qmd
to open it and choose "Open With...". I looked a little bit at whether we can hook a command up to get to this spot but don't see it quite yet.
This quick pick comes from doPickEditor()
with showDefaultPicker
set to true:
It doesn't look to me like any of that is exposed to extensions, for extensions to prompt this.
Oh nice yea if you hit "configure default" after Open with...
then if you set it to visual editor then i do see this in my settings.json now
"workbench.editorAssociations": {
"*.qmd": "quarto.visualEditor"
}
That's basically what I'm asking for, just as a slightly simplified version that would only show Source
and Visual
as options, and is more easily discovered through being a quarto command under > Quarto: Set Editor Default
in the command palette
It wouldn't have to use exactly the same UI, so we would not need to access that existing quick picker directly. We'd just make our own simple quick picker that only shows Source
and Visual
as options.
Or we can decide the current approach is good enough, if a bit hidden
Right now you can globally tell VS Code / Positron to use the visual editor by default for ALL qmd documents with this setting:
This is officially supported as the way for a user to set their global preference. It's the reason we set
priority: "option"
for our custom editor inpackage.json
https://code.visualstudio.com/api/references/contribution-points#contributes.customEditors
i.e. we don't forcibly take over qmds and make them open in visual mode, but a user can use this editor association option to opt in to this global override if they always want visual mode.
This is a super cool feature, but it's super hard to find!
I vote we make an ephemeral command that the user can call as something like
Quarto: Set Editor Default
who's sole job would be to follow up with a quick pick where the user can select eitherSource
orVisual
, and then based on their answer we set thiseditorAssociation
option for them. It's possible we should also ask them if they want it set at aUser
orWorkspace
level.Note that I do not think we should make this a quarto level option. That leaves the door open for the quarto option to get out of sync with the editor association option, like with manual editing of settings you can confusingly end up with this if we did an option:
and that seems bad. So having it as a command that just sets
editorAssociations
seems like a better way to do this.