-
Notifications
You must be signed in to change notification settings - Fork 293
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
Unsaved Notebook data is lost on exit #1746
Comments
Looking at some of the other issues, I see an overarching issue in that the Notebooks are not treated as first class citizen in VSCode. For example, when I open a Notebook I see this funny thing play out where VSCode will open it as a plain text file first, then quickly hide it and reopen as a Notebook. 🥴 That doesn't always work and I end up with a blank file. If I close and reopen, second time is usually a charm. (Should probably file a separate issue for that.) |
Thanks for the feedback @dimitry-ishenko , we will take a look! |
Came here to complain as I've just lost another notebook and see @rchiodo is working on it. Thank you! |
Validated. |
Note that this problem is especially bad if VSCode crashes or is closed accidentally (i.e. I errantly typed ctrl-w to delete a word from terminal habit but closed the tab and lost all my work. 🤦). Classic Jupyter as served in browser lets you reload the webpage and presents you with your unsaved changes. Likewise, VScode does something similiar with .py files. Please adopt the behavior from .py files:
Thanks so much for this excellent extension :) |
@tbenst If I understand it correctly (and @rchiodo can correct me if I am wrong) this and a host of other similar issues all depend on issue #1326. Notebook support was added through use of some dark voodoo and so they are not treated as first-class citizen in vscode. Until that changes, issues like this will keep popping up. |
Yes @dimitry-ishenko you're correct. We're working with VS code to make notebooks a first class citizen of VS code. That work was started here: However the problem with unsaved files not reopening should be fixed already. You do need to reactivate the python extension for it to work. We do have our own 'hot-save' mechanism, which is what VS code calls saving a backup copy of your work while you type. |
@rchiodo thank you sir, now I have something to look forward to 😄 @tbenst actually @rchiodo is correct this has been fixed. What I usually do is keep an empty python tab open to force the python extension reactivation, when I re-launch vscode: You can even create an empty python tab after you've closed and re-launched vscode and bring your notebook back from the dead: |
Unfortunately, this still seems to happen. I had a notebook with unsaved changes and exited vscode. There was no warning about unsaved changes. When I restarted vscode with the same workspace, the notebook was not automatically opened. I opened it manually, which must have triggered "reactivation", because then a second copy of the notebook was opened. Maybe that automatically opened second copy contained my unsaved changes – I don't know, because I clicked it away since it seemed redundant. I cannot find any trace of my unsaved changes in either of It would be great if one would be warned about unsaved changes upon exiting, or if |
@allefeld on a windows machine the 'hot exit' files are stored here:
They should have a file with a hash of the original file path. The root cause of the problem is the activation of the python extension that's required for us to reopen files. |
@rchiodo, I think that's Will this problem be solved with the undergoing redesign of custom editors in VS Code? At least a warning about unsaved changes would be extremely useful. |
Yes the redesign to use the VS custom editors will eliminate this entirely because we'll suddenly be known as an editor by VS code. They'll handle the hot exit/save/save as for us. |
Great, thanks! |
@allefeld when I switch Jupyter backend URI, the extension prompts me to restart VScode. I’ve found that it works if I do NOT restart VScode, but that upon restarting I cannot use the backend I entered. Perhaps this is why unsaved data is still lost for me? |
@tbenst, I'm not a developer, just a user like you. |
@DavidKutu and I both validated this. Validated. |
Just for everyone information - I was able to find my unsaved notebook with 2 days of work in "C:\Users\user\Local Settings\Temp" |
Bug: Notebook Editor, Interactive Window, Editor cells
Steps to cause the bug to occur
print("Hello abyss!")
in the cell and press Ctrl+Enter)Actual behavior
VSCode blissfully discards any unsaved changes.
Expected behavior
Either (a) an "Are you sure?"-type confirmation dialog is shown on exit; or (b) the file is restored, when VSCode is relaunched, which is what's done with other file types.
Your Jupyter and/or Python environment
Please provide as much info as you readily know
Developer Tools Console Output
Nah... that ain't me
Microsoft Data Science for VS Code Engineering Team: @rchiodo, @IanMatthewHuff, @DavidKutu, @DonJayamanne, @greazer
The text was updated successfully, but these errors were encountered: