-
Notifications
You must be signed in to change notification settings - Fork 28.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
customEditor toggle and save/preview keybinds #86505
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the expected behavior would be to have a single toggle command that does the following:
- If a custom editor is focused, then replace it with the normal text editor
- If a text editor is opened, then replace it with a custom editor (if one exists)
Let's get that working for unedited files first and then can figure out how to handle saves (because custom editors can also be edited)
@mjbvz Would |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good. Let me know if you have any questions about my comments
Thanks! This will be in the first VS Code 1.42 insiders builds later this week |
This PR aims to resolve #86504.
Tested on macOS High Sierra, Windows 10, and Ubuntu 18.04.3 LTS. Used
README.md
intest/
as a visual reference for keybinding and editor tests.Toggle
By pressing
CMD+E
on Mac, orCTRL+E
on Windows/Linux, the editor window opens a new tab in the same window that show either the default text editor or the custom Markdown preview editor, depending on the which editor was previously active editor. The toggle command does not get executed if in a context that does not have custom editors.Save-to-Preview
By pressing
CMD+Y
on Mac, orCTRL+Y
on Windows/Linux, the editor saves the changes—if any— of the text editor and switches to the custom editor. This command does not get executed if the context does not have custom editors. No changes are made if the custom editor is the currently active editor.Caveats
CMD+Y
instead ofCMD+S
because I had a difficult time getting the command to execute withCMD+S
. Experimenting with all the KeybindingWeight values in my custom save command changed nothing, so the next best thing was for me to use a different key altogether.CTRL+E
to toggle editors on Windows triggered to "Go to File..." command. Upon further inspection,CTRL+E
is a secondary source-defined binding for that command but only for Windows (Mac and Linux had only the primaryCTRL+P
bound).