Hide the editor Preview button when Positron provides a native preview split button#1025
Closed
juliasilge wants to merge 1 commit into
Closed
Hide the editor Preview button when Positron provides a native preview split button#1025juliasilge wants to merge 1 commit into
juliasilge wants to merge 1 commit into
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. |
Collaborator
Author
|
This is not actually the right thing to do, because it can impact |
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.
Positron 2026.07.0 is adding a native "Preview" split button to the editor action bar for Quarto documents as outlined in posit-dev/positron#12891: a "Preview" primary action plus a dropdown to preview specific formats. This extension also contributes its own Preview button to
editor/title/run, so in Positron both buttons would appear. The change in this PR hides the extension's button when Positron provides the native one, leaving a single Preview button.It is a no-op in VS Code and in older Positron versions.
How
quartoCanUsePositronPreviewSplitButtoncontext key, set once at activation incontext-keys.tswhenpositron.version >= "2026.07.0".editor/title/runquarto.previewcontribution on&& !quartoCanUsePositronPreviewSplitButton.The version check uses lexicographic string comparison rather than
semver, matching the existing approach inhost/positron.ts; Positron's zero-padded calendar versions such as2026.07.0are not valid semver, but the zero-padded year/month sort correctly as strings.Why a version gate rather than "is Positron"
The extension auto-updates from the marketplace independently of the Positron build, so a plain "hide whenever running in Positron" check would remove the button for users on older Positron versions that have no replacement button. Gating on the version means the button is hidden only once a Positron that actually provides the native split button is running. If that Positron release happens to slip past 2026.07.0 (which I assure you it WILL NOT 😉), the gate is a one-line follow-up.
No behavior change elsewhere
Testing
.qmd/.md/ the visual editor.