Enable Render on Save toggle in visual editor - #1121
Open
juliasilge wants to merge 2 commits into
Open
Conversation
Contributor
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The Render on Save checkbox appears in the visual editor's action bar, but it wasn't correctly working there. This PR makes the checkbox (more) correctly functional in the visual editor. I'll be honest that there is still some weirdness with the
quarto.render.renderOnSavesetting, but this is an improvement.This is the Quarto-side follow-up called out in posit-dev/positron#16022, which is making extension-contributed action bar checkboxes follow their command's
enablementexpression. cc @dhruvisompuraRoot cause
Two issues:
quarto.toggleRenderOnSavecommand'senablementwaseditorLangId == quarto, which doesn't match when the visual editor (a custom editor) is active so the checkbox was not fully/correctly enabled there.quarto.editor.type/quarto.editor.renderOnSave/quarto.editor.renderOnSaveShinycontext keys that drive the checkbox's checked state were only updated viaonDidChangeActiveTextEditor, which custom editors don't fire, so the state was stale even where the checkbox was visible.Changes
package.json: addactiveCustomEditorId == 'quarto.visualEditor'to the command'senablement, matching the pattern used by other menu contributions.editor.ts: add anonDidChangeActiveEditorevent to the visual editor tracker, fired from each tracked webview panel'sonDidChangeViewStatewhen its panel becomes active, and expose it viaVisualEditorProvider.onDidChangeActiveEditor().context-keys.ts: refactorsetEditorContextKeys/setLanguageContextKeysto take aTextDocument(they only ever used the document), subscribe to the new event so context keys refresh when a visual editor gains focus, and fall back to the active visual editor's document in the configuration-change listener.Validation
.qmdin visual mode: the checkbox appears and is clickable.