Skip to content

list.collapseAll leaves selection in a broken state #174768

Closed

Description

@akbyrd

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.

list collapseAll

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%
Extensions: none
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

  1. akbyrd commented on Feb 19, 2023

    @akbyrd
    ContributorAuthor

    Looking at this again in the File Explorer it looks like the selection highlight is left on the row where 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 enter opens a different thing.

  2. babakks commented on May 16, 2023

    @babakks
    Contributor

    João Moreno (@joaomoreno) Just submitted a PR for this. Could you please review it?

  3. modified the milestones: Backlog, on Dec 20, 2023
  4. added a commit that references this issue on Dec 20, 2023
    536ee35
  5. 2 remaining items

  6. added
    insiders-releasedPatch has been released in VS Code Insiders
    and removed
    unreleasedPatch has not yet been released in VS Code Insiders
    on Jan 3, 2024
  7. alexr00 commented on Jan 25, 2024

    @alexr00
    Member

    What is the behavior supposed to be? Here's what I see:

    1. Use keyboard to focus a tree node that has a parent
    2. ctrl+left to collapse all
    3. Focus moves to the whole tree and arrow down takes me to the first tree element. Right arrow does nothing.
  8. akbyrd commented on Jan 25, 2024

    @akbyrd
    ContributorAuthor

    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

    [ ] Root 1
    [x]     Child 1
    [ ] Root 2
    [ ]     Child 1
    

    End state, after collapseAll

    [x] Root 1
    [ ] Root 2
    

    Stat state

    [ ] Root 1
    [x]     Child 1
    [ ] Root 2
    [x]     Child 1
    

    End state

    [x] Root 1
    [x] Root 2
    
  9. joaomoreno commented on Jan 26, 2024

    @joaomoreno
    Contributor

    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.

  10. locked and limited conversation to collaborators on Jun 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bugIssue identified by VS Code Team member as probable bughelp wantedIssues identified as good community contribution opportunitiestree-widgetTree widget issuesverifiedVerification succeeded

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions