jupyterlab / extension-examples

JupyterLab Extensions by Examples
BSD 3-Clause "New" or "Revised" License
439 stars 167 forks source link

Tutoral how to add new command in the menu under an existing category #168

Closed pacospace closed 2 years ago

pacospace commented 3 years ago

Problem

I'm working on a jupyterlab-extension for dependency management [1]. Some users requested feature to delete kernels directly from the UI, instead of going to the terminal, so the following solution was introduced:

preview

I did not find a way to add the new command Kernel Delete... to the menu under Kernel, as I think that should be the place.

Proposed Solution

Additional context

NoobMaster1999 commented 2 years ago

I want to solve this issue. Can anyone please assign me the issue..???

fcollonval commented 2 years ago

Thanks for proposing your help. I'm unsure this requires a new example. The launcher example is adding an entry to the File>New submenu:

https://github.com/jupyterlab/extension-examples/blob/92e08148a59ee18420cdc22abff279f52d15cc8c/launcher/src/index.ts#L88

Basically you have to use the accessors of IMainMenu. Moreover in JupyterLab 3.1 a new mechanism to define menu from settings has been introduced. The menu example will be updated in #181.

if you want to help, I can provide you some pointer for #111, #134, #138 or #154.

pacospace commented 2 years ago

Thanks @fcollonval !!