-
Notifications
You must be signed in to change notification settings - Fork 29.3k
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
Explore notebook keymap support #106679
Comments
Now that Jupyter is a standalone extension (no longer part of the Python extension), it makes perfect sense that the Jupyter extension contributes the Jupyter style keybindings. It would be weird that if we publish a dedicated keymap extension and make it a dependency of the Jupyter extension. With that being said, the requirements are still there. Users may still have following requests (not that users have Jupyter extension installed)
Allowing the Jupyter ones to be disabled and switching between keybinding set easily is the major problem to solve. A domain specific keymap is kind of appealing:
But it comes with too many open questions: how do users disable the sub keymap? how do extensions contribute a sub keymap? how do extension declare which keybinding contributions belong to this domain level keymap? If we take one step back and ask ourselves, is this generic enough and deserving such a fancy solution? Considering the complexity of introducing a new concept of sub keymap, we can now go with a pragmatic solution: adding a setting cc @sandy081 , FYI just in case we have similar ideas brought up else where or sometime in the future. |
This can be solved by creating a Jupyter extension pack - Jupyter notebook extension + Jupyter keymap extension. Users can disable the keymap extension independent of notebook extension. There are also discussions going on about introducing optional dependencies, but I think extension pack is an appropriate solution here as there is no any code dependencies here. CCing @alexdima for switching keymaps. IMO it would be cool to allow user to switch keymaps. For eg., Show the list of keymap extensions in the quick pick (like themes) and allow user to switch. Internally, we can disable all other keymap extensions. |
👍 on having multiple extensions. Personally, I don't think keybindings should be shipped together with an extension that provides important functionality because keybindings are so personal to people, and the main selling point of the extension is the important functionality, not the keybindings of the established software. In other words, IMHO people would want to install the Jupyter extension for the Jupyter Notebooks functionality, and can then optionally install Jupyter keybindings if they really want those keybindings. |
Thanks, so the recommendation is to create a separate extension for the keybindings, sounds simple. |
@sandy081 and me had offline discussions about this and talked about why we call this "sub"-keymap support in the issue title. Basically I thought we can only have one activated keymap extension in VS Code workspace, while Jupyter keybindings will only work in notebook component, so we may want to support a case where users have a global keymap (e.g. Sublime) and a domain specific keymap (Jupyter). But that turns out to be false assumption. You might see a prompt for asking to you to disable other keymaps when installing from the Welcome page but you can always install keymap extensions from Extension View without any issue. They can work together but there might be some conflicts. For Jupyter keymap, it's not a big deal as existing keymaps don't cover the notebook component, so they can work together seamlessly. Agree with you all that putting Jupyter keybindings into a separate extension is the best approach here. The Jupyter core extension will contribute some Jupyter specific commands with default keybindings, when users install the Jupyter core extensions, both the notebook commands implemented by VS Code and Jupyter core extensions have proper default keybindings. If users want to use Jupyter style keybindings, then they install the Jupyter keymap extension. Note that to avoid any prompt when installing other real keymaps, the Jupyter keymap can leave the |
Closing since we have recommendation posted above. |
@rebornix Thanks for the suggestion. |
@sandy081 can you help confirm that currently it's not possible to archive this? If so, it left us the option of using a setting in Jupyter extension to disable the jupyter style keybindings. |
If extension B depends on extension A:
So an extension dependency has both an install-time consequence, but most importantly, a runtime consequence. I think the alternative to an extension dependency is an extension pack, since that has only install-time effects. cc @sandy081 for opinions |
Yeah extension pack has the flexibility to disable or uninstall extension A independent of the runtime. IMO from the concept perspective, using extensionPack is not appropriate. Coincidentally I am exploring an option for such requirements where a feature rich extension wants to optionally include additional features those are bundled as other extensions - #6384. I am assuming the solution we achieve there will also suffice yours. |
Reopening as current approach doesn't solve the problem fully and lead to user confusion of using the notebook editor the first time. |
@joyceerhl and I did some analysis of the complaints we received from users before/after adopting the suggestions we proposed above and revisited the keyboard shortcut conflicts review Joyce did last month. We found the complains are mostly from inconsistency between the behaviors of VS Code and Jupyter Classic/Lab, an experienced Jupyter users would find it broken even if the behavior changes slightly (or in some's opinions, correctly). Inconsistency/overlap
Now that we have ipynb serializer in the core, users are able to view Jupyter notebook files oob in VS Code, we can implement the Jupyter style commands in the core then users can always interact with the Jupyter notebooks in the way they prefer (no matter if it's Jupyter's keybindings or VS Code builtin ones, or a mix of both) through Keybindings Editor/ The next step would be figuring out how to help users choose the "keymap" to use in Jupyter notebook. One thing to note here is no matter what solution we choose, it won't change the fact that:
ProposalsA: Jupyter extension contributes all keybindingsThis is the same as before but Jupyter won't have their own command implementations. To run a Jupyter notebook (ctrl+enter, shift+enter), users need to install Jupyter extension (finding kernels). Pro
Con
B: Jupyter Keymap extension, shipped together with Jupyter but users can disable itWe ship Jupyter keybindings as a separate extension, but it's not a real exclusive "Keymap" extension. Jupyter will ship together with this extension (like the renderer extension) and users can disable it if they want Pro
Con
C: Keybindings in the core, with a setting controlling which keymap to useWe will have all the keybindings defined in the core, but introduce a setting Pro
Con
|
My understanding from todays discussion was that keymaps for Notebooks that are universal for all notebooks, Jupyter and custom alike. For now we'll ship the keymapping with the extension and push users to install the Jupyter extension (which contains everything they need from kernel detection to renderers) when they're trying to use a keybinding in the Notebook. Before having the Jupyter extension keymappings Notebooks will follow the VS Code built-in ones, after the extension all Notebooks will follow the Jupyter contributed ones. Users can disable the Jupyter keybindings if they want to. Currently all of the bugs about keybindings are of users who have the Jupyter extension but still have unexpected behaviour. We will fix these first and then be on look out for telemetry or user filed issues for not having the Jupyter keybindings out of the box. Custom Notebooks are in its infancy and we don't know enough yet about what the community of custom notebooks will expect so we can't yet conclusively state what their preferences and expectations of keybindings will be. Will they have Jupyter experience or only VS Code experience? We only have at most 100 engaged custom notebook users at the moment. I did a bit more exploring and asked Maria from the .NET team what their process of thinking behind keymaps were when they were making .dib Notebook. They kept the same keybindings as VS Code and had no filed issues around keybindings. |
We have good discussions offline. The default behavior of Run button is a problem which should be solved individually, as even with Proposal C, if users don't want the Run button to "Run + Insert" (default behavior of run button on Jupyter), we still need a solution to allow users to pick their preferred "Run" command to use. Thus it's not necessarily an advantage of Proposal C. Proposal B is more preferable as it functions the same as proposal A and it's easy for users to disable the whole keymap. In the meantime, it gives users a chance to use Jupyter keybindings with custom notebooks. When users have Jupyter extension installed, the notebook keybindings behave the same as Jupyter Classic/Lab (follow their muscle memory). For users who don't have Jupyter installed yet but they start to edit and run jupyter notebook, we can provide extension recommendation to them, like what we do for Kernel and Renderers, based on hueristics:
The recommendation can be presented through getting started (a section for Jupyter notebook, which mentions Kernel detection and Jupyter Renderer). |
Another topic we covered in the meeting was whether the Jupyter keymap should be shipped in the core and turned on all all notebooks. Having the keymap in the core helps with consistency and smoother transition from custom notebook to Jupyter, but it's arguable if the keybindings shipped with Jupyter Classic/Lab are the ones we want to offer to users as default ones, especially when the other notebook leaders/innovators behavior differently:
Recommending/find the right keymap to use will then be similar to notebook layouts, which depend on users' background and prior experience. Jupyter extension can ship keymaps which is the same as Jupyter Lab but users can install other keymaps. |
Thinking again about what would be good compromises, I think it does make sense to take the non-contentious keybindings and have them supported OOB and the other keybindings which don't fit well with VS Code's editing model can be contributed by the Jupyter extension. I'm thinking about these to be brought into core: Command
Edit
|
We will continue our work once we get #123581 (comment). |
Notebook actions we ship in the core have VS Code inspired keybindings bound to them, with which existing users can manipulate the notebook content with the keyboard shortcuts they are already with in the text editors.
However Jupyter users may prefer the Vim-like keybindings from traditional Jupyter web apps. Those keybindings may have conflicts with the builtin ones. To avoid conflicts, we can turn them into keymaps (builtin nb keymap and a Jupyter keymap) but they should be only scoped to Notebook (meaning you can install a sublime keymap for the whole workbench and also a notebook keymap).
The text was updated successfully, but these errors were encountered: