Skip to content

Text files are created in the default drive rather than in jupyter drives. #45

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

Open
ellisonbg opened this issue Dec 7, 2024 · 5 comments
Labels
bug Something isn't working

Comments

@ellisonbg
Copy link
Contributor

When I navigate to a directory under a bucket and then click on the launcher button in the jupyter-drives file browser panel and use the launcher to create a text or python file, the file is created, but in the root dir of the default drive, rather than the current bucket path.

@ellisonbg
Copy link
Contributor Author

Notebooks creating in the launcher are created in the cwd of the jupyter drive launcher. Interestingly, if you right click and create the text file using the context menu of the file browser, it works fine.

@ellisonbg
Copy link
Contributor Author

Another clue - the launcher for the default file browser shows the current directory at the top. The launcher for the jupyter-drives file browser doesn't show this.

@DenisaCG DenisaCG added the bug Something isn't working label Dec 9, 2024
@DenisaCG
Copy link
Member

Thank you for opening this issue and looking further into it!

The problem is coming from the launcher, as it is automatically connected to the default file browser, so all commands and items will be performed on it and the paths extracted there. The linked PR offers a temporary solution, to disable the default launcher plugin and replace with a new one in which it gets the current file browser in focus and open the launcher connected to that.

@ellisonbg
Copy link
Contributor Author

Makes sense, but how does it work creating notebooks?

@DenisaCG
Copy link
Member

Great point, thanks for catching this.

Diving deeper into the JupyterLab code, it seems that the command to create a notebook gets the currentBrowser (as we are doing in the open PR) and finds the cwd using it. This would explain how it creates the notebook in the opened drive, instead of always choosing the default file browser:
https://github.com/jupyterlab/jupyterlab/blob/c1cafae8c78ef0ff56136dc4a018bef1b5626333/packages/notebook-extension/src/index.ts#L1980-L1981

On the other hand, all other commands, such as creating a text file, get the cwd from the default browser automatically:
https://github.com/jupyterlab/jupyterlab/blob/c1cafae8c78ef0ff56136dc4a018bef1b5626333/packages/fileeditor-extension/src/commands.ts#L805

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants