Skip to content

fix: prevent indentation shift for tree items without parent icons#308165

Open
maruthang wants to merge 1 commit intomicrosoft:mainfrom
maruthang:fix/issue-307350-treeview-indent
Open

fix: prevent indentation shift for tree items without parent icons#308165
maruthang wants to merge 1 commit intomicrosoft:mainfrom
maruthang:fix/issue-307350-treeview-indent

Conversation

@maruthang
Copy link
Copy Markdown
Contributor

Fixes #307350

Summary

  • When a collapsible parent item lacks an icon, alignIconWithTwisty() incorrectly triggered alignment for leaf children, hiding their twistie space (width: 0) while collapsible siblings kept theirs. This caused inconsistent indentation at the same depth level.
  • Changed the "parent lacks icon" case in alignIconWithTwisty() to return false, so alignment only applies when the parent has an icon and can establish a consistent visual hierarchy.
  • The "parent has icon" case (line 1653) remains unchanged and continues to work correctly.

Test plan

  • Create a TreeView extension with mixed items:
    • Group items (collapsible) WITHOUT icons
    • Leaf items WITH icons
    • At the same depth level
  • Verify that all items at the same depth have consistent indentation
  • Verify group items WITH icons still produce correct alignment for their leaf children
  • Verify toggling between grouped/ungrouped doesn't cause indentation shifts

When a collapsible parent item lacks an icon, alignIconWithTwisty()
incorrectly triggered alignment for leaf children. This caused leaf
items to shift left (twistie space hidden) while collapsible siblings
kept their twistie space, resulting in inconsistent indentation at the
same depth level.

Return false from alignIconWithTwisty when the parent lacks an icon,
so the alignment only applies when the parent has an icon and can
establish a consistent visual hierarchy.

Fixes microsoft#307350
@vs-code-engineering
Copy link
Copy Markdown
Contributor

📬 CODENOTIFY

The following users are being notified based on files changed in this PR:

@bpasero

Matched files:

  • src/vs/workbench/browser/parts/views/treeView.ts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

visual: TreeView items without icons shift parent indentation

2 participants