microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
163.61k stars 29.03k forks source link

Cell collapse doesn't persist between VSC sessions #168807

Open minsa110 opened 1 year ago

minsa110 commented 1 year ago

Collapsed cell inputs / outputs should persist between VSC sessions because conducting data analysis often span multiple days--many times with long inputs / outputs.

Steps to repro:

  1. Open or create an ipynb file
  2. Collapse some cell inputs and/or outputs
  3. Close VS Code
  4. Open VS Code
  5. 🐛 All cell inputs and outputs are expanded

Cell collapse do work:

roblourens commented 1 year ago

I saw this a couple times, but it worked 95% of the time. When it breaks, we have a persisted state object, but collapsedInputCells is empty. I'm wondering whether we could have disposed cell VM objects before the last call to getEditorViewState. Any other ideas @rebornix?

vttrifonov commented 1 year ago

Not sure if this covers persisting the collapsed cells in the saved ipynb file (the OP only mentions closing/opening VSCode so perhaps they expect persistence at the VSCode tab level) but right now in my current VScode/Jupyter set up cells are expanded every time I open an ipynb file in which I had collapsed cells previously and then saved and closed the notebook.

I am running Jupyter extension v2022.3.1000901801.

Looking at jupyterlab/jupyterlab#3981 it seems that the functionality is available on the jupyter end.

Happily-Coding commented 3 months ago

Possibly related to this, header sections collapse is not restored depending on the settings. Its worth noting that at least in my case the issue only happens when header arrows are set to display only on hover instead of always. Please see https://stackoverflow.com/questions/78722953/how-can-i-make-hidden-headers-preserve-their-state-in-vs-code for more details and a workaround for header sections collapse until its fixed.

austengary33 commented 2 weeks ago

Any updates on this? Would really like to see this implemented!