This repository has been archived by the owner on Dec 15, 2022. It is now read-only.
[WIP] Add options to automatically open and close previews #516
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.
Requirements
Description of the Change
This is an experimental PR that adds support for automatically opening and closing Markdown Previews when Markdown files are (un)focused. Features:
markdown-preview.automaticallyOpenPreview
will automatically open a preview pane when a Markdown file is focused.markdown-preview.automaticallyClosePreview
will automatically close a preview pane when its corresponding Markdown file is no longer focused.markdown-preview.automaticPreviewGrammars
handles the list of grammars for which a preview will automatically be opened.Alternate Designs
Some thoughts:
Set
the correct data structure for holding the list of destroyed items? Is it even possible for the set to have more than one item in it beforeonDidChangeActivePaneItem
is called?automaticPreviewGrammars
, because it turned out to be really annoying for the preview to appear when opening a new untitled tab. I'd like to keep the number of options down but I'm not sure how to work around this.Benefits
Automatic previews!
Possible Drawbacks
When just moving over tabs it can get distracting for a new preview to appear then almost immediately disappear. I've tried to add as many early returns as possible so performance should not be impacted if these options are enabled.
Applicable Issues
Closes #423