shd101wyy / vscode-markdown-preview-enhanced

One of the "BEST" markdown preview extensions for Visual Studio Code
https://shd101wyy.github.io/markdown-preview-enhanced
Other
1.47k stars 173 forks source link

Feature request: enhance preview window auto open/close behavior #1425

Open koenlek opened 5 years ago

koenlek commented 5 years ago

I think the current behavior of automatic opening and closing previews is a bit shaky to me. If been thinking a bit on how it could be solved and have some idea now. I'm curious what others think. Please consider my proposal below.

I am using Atom, so this issue is focused on Atom. I'm not sure how well it would translate to VS Code.

Related issues that could possibly be closed by such a rewrite: shd101wyy/markdown-preview-enhanced#719, shd101wyy/vscode-markdown-preview-enhanced#1707, shd101wyy/vscode-markdown-preview-enhanced#1426

Current behavior

Nice

Not so nice

Proposed behavior

I'd personally argue to only support a "Open Only One Preview" mode (so don't make it an option, just enforce it). That probably simplifies the "auto preview open/close" code (no need to keep track editor/preview pairs), making it easier to maintain and less bug-prone.

In such a mode:

To me, the above functionality would be absolutely awesome! Some challenges I foresee:

If you don't want to strip the old behavior (yet), consider adding this as a new experimental feature (enabled by default šŸ™?) called something like: "Only show preview for current markdown file" with extra text "Will make sure a preview is shown for current file being edited only, and will automatically close if current active file is not a markdown file".

Another cool extra option that came to mind:

LeonardoRick commented 1 year ago

What are the plans for enhancing it? It seems for me that not even with "Single Preview" enabled the preview closes when I close the Md file. It keeps opened and would be nice to have this features out of the box!