Repository navigation
list.collapseAll leaves selection in a broken state #174768
Description
Type: Bug
When pressing ctrl+left to collapse all nodes in a list view it leaves selection in such a state that you cannot expand nodes with right until you do something to change the selection.
I believe what's happening is list.collapseAll is leaving the originally selected node selected. So after executing the command you end up with 2 selections, your original selection plus the last root node in the list. The original selection is the primary selection, and if it has no children right does not have anything to expand and is a no-op.
As a user it looks like you have the root node selected, which has children to expand, but pressing right does nothing.
Pressing down then expands the list to reveal your original selection and you see that you unexpectedly have multiple selections.
The current behavior of list.collapseAll appears to be:
- Leave the originally selected node selected
- Add a second selection to the last root node in the list
The expected behavior here is:
- Move selection to the root node of your currently selected node
- Ideally this also retains multiple selection: each selection is moved to the root node of that selection.
VS Code version: Code - Insiders 1.76.0-insider (c7930ca, 2023-02-10T16:22:19.445Z)
OS version: Windows_NT x64 10.0.19045
Modes:
Sandboxed: Yes
System Info
| Item | Value |
|---|---|
| CPUs | AMD Ryzen 9 5950X 16-Core Processor (32 x 3400) |
| GPU Status | 2d_canvas: enabled canvas_oop_rasterization: disabled_off 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_renderer: enabled_on video_decode: enabled video_encode: enabled vulkan: disabled_off webgl: enabled webgl2: enabled webgpu: disabled_off |
| Load (avg) | undefined |
| Memory (System) | 31.92GB (20.54GB free) |
| Process Argv | --crash-reporter-id 22cf4e37-a96e-4ad9-82f0-8715f8e2bf6e |
| Screen Reader | no |
| VM | 0% |
A/B Experiments
vsliv695:30137379
vsins829:30139715
vsliv368cf:30146710
vsreu685:30147344
python383:30185418
vspor879:30202332
vspor708:30202333
vspor363:30204092
vslsvsres303:30308271
pythonvspyl392:30422396
pythontb:30258533
pythonptprofiler:30281269
vsdfh931cf:30280410
vshan820:30294714
pythondataviewer:30285072
vscod805cf:30301675
bridge0708:30335490
bridge0723:30353136
cmake_vspar411:30581797
vsaa593cf:30376535
pythonvs932:30404738
cppdebug:30492333
vsclangdf:30492506
c4g48928:30535728
dsvsc012cf:30540253
pynewext54:30618038
pylantcb52:30590116
pyindex848:30611229
nodejswelcome1:30587009
pyind779:30611226
pythonsymbol12:30651887
2i9eh265:30646982
showlangstatbar:30659908
pythonb192cf:30661257

Activity
akbyrd commentedon Feb 19, 2023
Looking at this again in the File Explorer it looks like the selection highlight is left on the
rowwhere the original selection was despite the fact that the node is now in a different position. However, the "real" selection is still on the node.This means it looks like one thing is highlighted and pressing
enteropens a different thing.babakks commentedon May 16, 2023
João Moreno (@joaomoreno) Just submitted a PR for this. Could you please review it?
undo general focus/selection preservation from lists and trees
2 remaining items
alexr00 commentedon Jan 25, 2024
What is the behavior supposed to be? Here's what I see:
ctrl+leftto collapse allakbyrd commentedon Jan 25, 2024
The current behavior sort-of fixes the issue, insofar as is dodges it by doing something less desirable - moves selection to the whole tree.
Imo, selection should remain on the root node(s) of whichever tree branch selection is currently in. I think this is what the previous behavior was trying to do, it just had an issue with leaving selection in a bad state.
A couple examples ([x] denotes current selection):
Start state
End state, after
collapseAllStat state
End state
joaomoreno commentedon Jan 26, 2024
I agree, feel free to send an issue for it. 👌
Alex Ross (@alexr00) Your observations are the fixed state. Here's the entire story: #182601 (comment). Marking it as verified.