microsoft / vscode

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

.ipynb cannot reorder cells #211548

Open p-i- opened 6 months ago

p-i- commented 6 months ago

Type: Bug

I have a notebook with 3 cells, A B C

I want to drag C so that it is between A and B.

I CANNOT DO IT.

Drag-drop simply doesn't work. I hover over the margin of cell C, so that the cursor becomes a hand. Clearly this is indicating that I can drag to move it.

So I drag. I'm expecting a thick line between A and B to glow as I hover over it.

BUT IT DOESN'T.

It DID work. I KNOW I used to be able to drag-drop reorder cells. But now I CANNOT.

Now I look for a menu-item for "move cell up/down". Not on the right "...". Not on the left (right-click). Nowhere in the menu. I know this exists for browser-based Jupyter notebooks.

The only thing I can see is to cut/paste cells. Why can't I drag-drop to move them? Why?

Such UX creates great frustration. :L

VS Code version: Code 1.88.1 (e170252f762678dec6ca2cc69aba1570769a5d39, 2024-04-10T17:43:08.196Z) OS version: Darwin arm64 23.4.0 Modes:

System Info |Item|Value| |---|---| |CPUs|Apple M2 (8 x 24)| |GPU Status|2d_canvas: enabled
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: enabled
video_encode: enabled
webgl: enabled
webgl2: enabled
webgpu: enabled| |Load (avg)|2, 2, 2| |Memory (System)|24.00GB (0.75GB free)| |Process Argv|--crash-reporter-id f10d97cd-2115-4dba-a34a-07be9312995a| |Screen Reader|no| |VM|0%|
Extensions (18) Extension|Author (truncated)|Version ---|---|--- dvt-remote-ssh|ami|1.0.0 copilot|Git|1.184.0 copilot-chat|Git|0.14.1 vsc-python-indent|Kev|1.18.0 rainbow-csv|mec|3.11.0 vscode-docker|ms-|1.29.0 debugpy|ms-|2024.4.0 python|ms-|2024.4.1 vscode-pylance|ms-|2024.4.1 jupyter|ms-|2024.3.1 jupyter-keymap|ms-|1.1.2 jupyter-renderers|ms-|1.0.17 vscode-jupyter-cell-tags|ms-|0.1.9 vscode-jupyter-slideshow|ms-|0.1.6 remote-containers|ms-|0.354.0 remote-ssh|ms-|0.110.1 remote-ssh-edit|ms-|0.86.0 remote-explorer|ms-|0.4.3 (1 theme extensions excluded)
A/B Experiments ``` vsliv368cf:30146710 vspor879:30202332 vspor708:30202333 vspor363:30204092 vstes627:30244334 vscorecescf:30445987 vscod805cf:30301675 binariesv615:30325510 vsaa593cf:30376535 py29gd2263:31024239 vscaac:30438847 c4g48928:30535728 azure-dev_surveyone:30548225 2i9eh265:30646982 962ge761:30959799 pythongtdpath:30769146 welcomedialog:30910333 pythonidxpt:30866567 pythonnoceb:30805159 asynctok:30898717 pythontestfixt:30902429 pythonregdiag2:30936856 pyreplss1:30897532 pythonmypyd1:30879173 pythoncet0:30885854 2e7ec940:31000449 pythontbext0:30879054 accentitlementst:30995554 dsvsc016:30899300 dsvsc017:30899301 dsvsc018:30899302 cppperfnew:31000557 fegfb526:30981948 bg6jg535:30979843 ccp2r3:30993541 dsvsc020:30976470 pythonait:31006305 gee8j676:31009558 chatpanelt:31018789 dsvsc021:30996838 jg8ic977:31013176 pythoncenvpt:31022790 ```
rebornix commented 5 months ago

@p-i- can you please share a screen recording of what you were seeing? Were these 3 cells all code cells? Thanks in advance!

vscodenpa commented 5 months ago

Thanks for creating this issue! We figured it's missing some basic information or in some other way doesn't follow our issue reporting guidelines. Please take the time to review these and update the issue.

Happy Coding!

p-i- commented 5 months ago

I have just tried to reproduce the issue and been unable. Feel welcome to close the issue. As I don't know whether it's an intermittent fault or something has been fixed in VSCode since my filing the issue, I won't make a move to close it myself.

nicolnt commented 5 months ago

Same here Demo: 20240619 - Drag cells in jupyter notebook

File: 20240619 - pymrio-exiobase.zip

VS Code version: Code 1.90.1 (611f9bfce64f25108829dd295f54a6894e87339d, 2024-06-11T21:01:24.262Z) OS version: Windows_NT x64 10.0.19045 Modes: Remote OS version: Linux x64 5.15.146.1-microsoft-standard-WSL2

System Info |Item|Value| |---|---| |CPUs|13th Gen Intel(R) Core(TM) i7-13700H (20 x 2918)| |GPU Status|2d_canvas: enabled
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled| |Load (avg)|undefined| |Memory (System)|31.69GB (12.92GB free)| |Process Argv|--crash-reporter-id 1833d069-5a08-440d-8afb-e9f9d0aff177| |Screen Reader|no| |VM|0%| |Item|Value| |---|---| |Remote|WSL: Ubuntu| |OS|Linux x64 5.15.146.1-microsoft-standard-WSL2| |CPUs|13th Gen Intel(R) Core(TM) i7-13700H (20 x 0)| |Memory (System)|15.47GB (13.87GB free)| |VM|0%|
Extensions (12) Extension|Author (truncated)|Version ---|---|--- jupyter-keymap|ms-|1.1.2 remote-wsl|ms-|0.88.2 gitlens|eam|15.1.0 debugpy|ms-|2024.6.0 python|ms-|2024.8.1 vscode-pylance|ms-|2024.6.1 jupyter|ms-|2024.5.0 jupyter-keymap|ms-|1.1.2 jupyter-renderers|ms-|1.0.18 vscode-jupyter-cell-tags|ms-|0.1.9 vscode-jupyter-slideshow|ms-|0.1.6 vscode-typescript-next|ms-|5.6.20240618
A/B Experiments ``` vsliv368cf:30146710 vspor879:30202332 vspor708:30202333 vspor363:30204092 vscorecescf:30445987 vscod805cf:30301675 binariesv615:30325510 vsaa593cf:30376535 py29gd2263:31024239 c4g48928:30535728 azure-dev_surveyone:30548225 962ge761:30959799 pythongtdpath:30769146 welcomedialog:30910333 pythonidxpt:30866567 pythonnoceb:30805159 asynctok:30898717 pythontestfixt:30902429 pythonregdiag2:30936856 pythonmypyd1:30879173 2e7ec940:31000449 pythontbext0:30879054 accentitlementst:30995554 dsvsc016:30899300 dsvsc017:30899301 dsvsc018:30899302 cppperfnew:31000557 dsvsc020:30976470 pythonait:31006305 jchc7451:31067544 showvideot:31016892 chatpanelc:31048052 dsvsc021:30996838 da93g388:31013173 pythoncenvpt:31062603 a69g1124:31058053 dvdeprecation:31068756 pythonprt:31056678 dwnewjupytercf:31046870 impr_priority:31077527 ```
dmcmurchy commented 5 months ago

I also have the same exact same behaviour as demonstrated by @nicolnt.

p-i- commented 4 months ago

I remember ages back a colleague tweaked a couple of my VSCode settings to compress the notebook UI vertically, just to squeeze out a little more MacBook LCD real estate.

I wonder if that's related.

If @nicolnt or @dmcmurchy can confirm they HAVEN'T done the same kind of thing, we could rule that out.

dmcmurchy commented 4 months ago

I don't typically play around with the settings and it's only me that touches my setup.

I was using the centered layout (and have been for a least 3 or more releases) and disabled that. It's still behaving about the same, but, if I move a markdown cell up past my code cells above another markdown cell it'll move into place (but not below it).

When trying to move it back to where it was originally is a total bust. I have to move it down past all the code cells again to above the next markdown cell before it would drop into place. I can't move any of the code cells.

I went back to centered layout and got the same behavior again.

Typically, the only thing I have open is the notebook editor and nothing else.

p-i- commented 4 months ago

This is still annoying me, so I captured it.

(btw I upgraded my VSCode last night to the latest).

  1. The fail happened
  2. I created a fresh test.ipynb, created 3 cells (1,2,3), replicated the fail
  3. I created a fresh .venv in a test/ subfolder, opened VSCode afresh in this folder, started RECORDING, again created a fresh test2.ipynb, created 3 cells (1,2,3), but now it WORKS.
  4. I go back to the open test.ipynb in step 2, and observe it is STILL FAILING.

https://github.com/microsoft/vscode/assets/693495/a518e151-b180-4e9a-9c55-4dd4507cbdde

So there you have it. Inconsistent behaviour.

It looks like maybe the running VSCode instance somehow gets corrupted.

When you fix, please consider this UX when you drag-drop: as soon as you initiate a drag, darken everything except the valid drop-targets (which can be brightened or some motion-anim to attract attention). Would be super-neat to see where we can drag-drop TO.

p-i- commented 3 months ago

@rebornix Are you able to reproduce?

xms991 commented 2 months ago

Just want to add that I experienced this bug today and was able to get it working again via full clean VSC uninstall/reinstall.

Notes on bug:

When the bug occurs, I am still able to drag cells between the very top and very bottom of a notebook, and when I do so, the blue preview line appears prior to dropping the cell.

When you attempt to drag cells between other existing cells, no blue preview line appears, and dropping the cell does not result in the cell moving.

OS and VSC Version Info

MacOS Ventura 13.4.1

VSC Version: 1.92.2 (Universal) Commit: fee1edb8d6d72a0ddff41e5f71a671c23ed924b9

Unsuccessful Troubleshooting Steps:

  1. Closing and reopening file and workspace
  2. Restarting python kernel
  3. Uninstalling Jupyter VSC extension, restarting extensions, reinstalling Jupyter VSC extension
  4. Uninstalling VSC (dragging Application to trash), re-downloading VSC and re-installing (dragging to Applications folder)
  5. Manually copying code from each cell into cells in a new Jupyter notebook
  6. Rebooting MacOS
  7. Uninstalling VSC (Dragging application to trash), deleting /users/myusername/.vscode folder and then redownloading/reinstalling.

Temporary Workaround

Uninstalling VSC, deleting /users/myusername/.vscode and reinstalling did not resolve the issue.

Uninstalling VSC, deleting /users/myusername/.vscode and deleting /users/myusername/Library/Application Support/Code prior to reinstalling did work, so it seems like something in that folder is the cause, but I am not sure what specifically that could be.

Hopefully the issue doesn't come back and the devs can figure it out and get this fixed soon.