This repository was archived by the owner on Dec 15, 2022. It is now read-only.
[WIP] Add options to automatically open and close previews#516
Open
[WIP] Add options to automatically open and close previews#516
Conversation
2d1eb5d to
19331b9
Compare
|
I have some background on this issue as I also took it upon me and finished with it after you. If you would like I can share my tests if you want.
No, as you say yourself there are situations that benefit separated auto open and close previews e.g. you only work on one md file at a time and want it to stay open while you switch focus.
I think it is a correct data structure as it complies with the requirements for a destroyedItem. I guess you can have more than one item in destroyedItems, e.g. if you destroy two previews within 100ms you will have two items in it.
I think this is a great way of avoiding the untitled tab and making it more modular if you want some specific file to be opened. |
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.automaticallyOpenPreviewwill automatically open a preview pane when a Markdown file is focused.markdown-preview.automaticallyClosePreviewwill automatically close a preview pane when its corresponding Markdown file is no longer focused.markdown-preview.automaticPreviewGrammarshandles the list of grammars for which a preview will automatically be opened.Alternate Designs
Some thoughts:
Setthe 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 beforeonDidChangeActivePaneItemis 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