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

File is wrongly renamed if the widget title is changed by extension #10856

Open
djangoliv opened this issue Aug 17, 2021 · 4 comments
Open

File is wrongly renamed if the widget title is changed by extension #10856

djangoliv opened this issue Aug 17, 2021 · 4 comments

Comments

@djangoliv
Copy link

Description

I have an extension that renames the title of the notebooks tab. In this case, opening the file with collaborative editing will rename the file according to the tab title.

Reproduce

Create en extension with this few lines:


 const newWidget = this._docmanager.openOrReveal("notebook_name.ipynb");
 newWidget.title.label = "custom-title"

In this case, the file "notebook_name.ipynb" will be renamed to "custom-title".

Expected behavior

There is 2 solutions:

  • prevent developer from changing tab title
  • don't base filename on tab name (better)

Context

  • JupyterLab version: 3.1.7
@hbcarlos
Copy link
Member

Hi @djangoliv, thanks for opening this issue!
After digging a little bit, I find out this is coming from #10518.
There is a discussion here #10269.

Pinging @cameron-toy and @jasongrout since they were working on this.

@krassowski
Copy link
Member

krassowski commented Sep 4, 2021

Ouch, this is bad. I am changing tab titles for external files in a couple of extensions (LSP, jump-to-definition) to show " (external)" annotation. It turns out that now it renames the files, including system files on disk, see https://github.com/krassowski/jupyterlab-lsp/issues/669#issuecomment-913055706, breaking users conda/Python installations. I really believe we should retain the separation between tab label and the file name or this use case is doomed.

@jasongrout
Copy link
Contributor

I really believe we should retain the separation between tab label and the file name or this use case is doomed.

We hadn't considered a usecase like this (the tab title for a document not being the document name). We'll have to figure out, then how to reconcile that with the workflow of double-clicking on a tab to edit the document name. I suppose an obvious solution is to introduce a new piece of data in the widget title, which is the editable data in the title. Another solution would be to have a concept of annotations to a widget title that are displayed (for example, I can imagine annotating the title with an emoji signifying the current kernel state). Another solution would be to have the document hook into the double-click event on the tab somehow and present its own dialog (is that what we used to have?). That wouldn't be in-place editing, though.

@krassowski
Copy link
Member

I'm assigning this to 4.1 milestone as this is a data-safety critical bug and several extensions/code use-cases would benefit from being able to change tab label or add admonitions without triggering deleterious side-efects, for example:

This was also requested on our gitter channel.

@krassowski krassowski added this to the 4.1.0 milestone Mar 22, 2023
@krassowski krassowski changed the title Real-time collaborative edition rename file if the widget title is changed File is wrongly renamed if the widget title is changed by extension Mar 22, 2023
@krassowski krassowski modified the milestones: 4.1.0, 4.1.x Feb 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants