vscode-jupyter: Unsaved Notebook data is lost on exit

Bug: Notebook Editor, Interactive Window, Editor cells

Steps to cause the bug to occur

  1. Launch VSCode.
  2. Create new blank Notebook (Ctrl+Shift+P then enter Python: Create Blank New Jupyter Notebook)
  3. Modify the notebook (eg, enter print("Hello abyss!") in the cell and press Ctrl+Enter)
  4. Close VSCode.
  5. Re-launch VSCode.
  6. Witness your work gone into the abyss.
  7. Optional: Smash computer screen with heavy object.

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

  • Jupyter server running: N/A
  • Extension version: v2020.4.76186
  • VS Code version: 1.45
  • Setting python.jediEnabled: false
  • Python and/or Anaconda version: python 3.8.2 (no Anaconda)
  • OS: Ubuntu 20.04 LTS
  • Virtual environment: N/A

Developer Tools Console Output

Nah… that ain’t me

Microsoft Data Science for VS Code Engineering Team: @rchiodo, @IanMatthewHuff, @DavidKutu, @DonJayamanne, @greazer

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 6
  • Comments: 17 (6 by maintainers)

Most upvoted comments

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:

  1. add the x or o icon on the notebook viewer tab
  2. prompt to save if closing
  3. restore unsaved on crash

Thanks so much for this excellent extension 😃

@DavidKutu and I both validated this. Validated.

Came here to complain as I’ve just lost another notebook and see @rchiodo is working on it. Thank you!

Thanks for the feedback @dimitry-ishenko , we will take a look!