Skip to content
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

How do fetch notebook or current file path for a jupyterlab extension the way the Rename widget does? #204

Open
luis-chaves-visa opened this issue Aug 10, 2022 · 1 comment
Labels
enhancement New feature or request

Comments

@luis-chaves-visa
Copy link

The Rename action that appears when a user right-clicks a notebook name on the tab section

image

displays the path of the current file:

image

I was wondering how it does that, I'd like to replicate that functionality for my extension, I've browsed through jupyterlab's source code but wasn't able to find an answer.

@luis-chaves-visa luis-chaves-visa added the enhancement New feature or request label Aug 10, 2022
@fcollonval
Copy link
Member

@luis-chaves-visa usually an user interaction is linked to triggering a command (like when a user click a menu entry, press shortcut keys, click on simple toolbar buttons,...). That said it may not be easy to find which one.

A good place to look for is the latest version of the documentation that list all available commands: https://jupyterlab.readthedocs.io/en/latest/user/commands.html

In the case of the rename action, the command is docmanager:rename. And its implementation is at https://github.com/jupyterlab/jupyterlab/blob/7b57518f284fea3ceeb0479352897c720779500d/packages/docmanager-extension/src/index.tsx#L918

The code logic is:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants