Repository navigation
customEditor toggle and save/preview keybinds - #86505
Conversation
Matt Bierner (mjbvz)
left a comment
There was a problem hiding this comment.
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)
|
Matt Bierner (@mjbvz) Would |
Matt Bierner (mjbvz)
left a comment
There was a problem hiding this comment.
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.mdintest/as a visual reference for keybinding and editor tests.Toggle
By pressing
CMD+Eon Mac, orCTRL+Eon 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+Yon Mac, orCTRL+Yon 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+Yinstead ofCMD+Sbecause 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+Eto toggle editors on Windows triggered to "Go to File..." command. Upon further inspection,CTRL+Eis a secondary source-defined binding for that command but only for Windows (Mac and Linux had only the primaryCTRL+Pbound).