-
Notifications
You must be signed in to change notification settings - Fork 30.1k
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
Cell context menu should use NotebookCell as context like the cell toolbar #162018
Comments
I don't think we have any way to customize this, the editor controls the context and all editor context menu actions have the same context
We could handle this for builtin commands, but for commands from extensions, it would still be better to give the same context as the cell toolbar. Maybe we could register a wrapper action for every command in the cell toolbar that translates the context and executes the real command? Or we have to plumb a way for the editor to let us change the context of some menu items or something like that which seems awkward. Any other ideas @rebornix @jrieken? |
I think using |
I'm not saying that all editor commands should have a different context- only commands that end up in the "Notebook Cell" submenu automatically as a result of being contributed to the cell title menu:
The result would be that a notebook command gets the same context whether it was invoked from the cell title toolbar or from the cell context menu. Other editor commands wouldn't be affected. We can also say that commands will get a different context depending on which menu they are invoked from, but it seems nicer to be consistent especially if extensions will contribute to the toolbar and not test the command in the context menu, then they don't work there (as in microsoft/vscode-jupyter#7751) |
Oh, now I get it. Unsure what/how to do it. Why do we have this menu at all? It seems weird to duplicate a title menu into the context menu |
I can see the value of having notebook cell actions in the editor context menu as users would always get those actions no matter if they right click on cell container, or cell editor. My original issue was about aligning the context for Cell container context menu (right click on cell container/chrome), which is different from the cell editor context menu. I'm not convinced that we want to change how we populate context for editor context menu so thinking about this again, I think it's fine that cell commands' context is |
Oh, I didn't even pick up on that.
I think that's ok, if only because we don't have a good solution to customizing the context for editor cell commands. Then for this issue I'll just fix commands to work with a Uri context. These menu contexts aren't really documented for extensions though, right? It's a bit tricky to work it out by experimenting.
You can even hide the toolbar 😭 |
The cell context menu in notebook editor is using
UriComponents
as context, but the cell toolbar is usingNotebookCell
. Since we populate commands from cell toolbar to the cell context menu, those commands won't work in cell context menu. We should have them aligned.The text was updated successfully, but these errors were encountered: