Skip to content

Fix folder ThemeIcon causing incorrect tree level inset#323694

Draft
Copilot wants to merge 2 commits into
mainfrom
copilot/fix-folder-themeicon-inset
Draft

Fix folder ThemeIcon causing incorrect tree level inset#323694
Copilot wants to merge 2 commits into
mainfrom
copilot/fix-folder-themeicon-inset

Conversation

Copilot AI commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Description

A custom tree view parent item using ThemeIcon("folder") rendered its children at the wrong tree-level inset, while any other icon aligned correctly.

Root cause: Aligner.hasIcon in treeView.ts decided whether an item "has an icon" by deferring file/folder ThemeIcons to the file icon theme (folder required hasFileIcons && hasFolderIcons). But TreeRenderer actually draws a file/folder ThemeIcon as an always-present codicon whenever the item has no resource (per shouldShowThemeIcon). The mismatch made alignIconWithTwisty treat the parent as icon-less and pick the wrong branch, shifting the children's inset.

Changes:

  • Aligner.hasIcon — treat any ThemeIcon that renders as a codicon as having an icon, mirroring the renderer:
// Any other ThemeIcon, or a `file`/`folder` ThemeIcon on an item without a resource,
// is always rendered as a codicon and therefore always has an icon.
if (node.themeIcon && (!node.resourceUri || (node.themeIcon.id !== FileThemeIcon.id && node.themeIcon.id !== FolderThemeIcon.id))) {
    return true;
}

file/folder icons on items that do have a resource still defer to the file icon theme, unchanged.

Copilot AI requested review from Copilot and removed request for Copilot June 30, 2026 09:25
Copilot AI linked an issue Jun 30, 2026 that may be closed by this pull request
Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com>
Copilot AI requested review from Copilot and removed request for Copilot June 30, 2026 09:38
Copilot AI changed the title [WIP] Fix folder ThemeIcon causing incorrect tree level inset Fix folder ThemeIcon causing incorrect tree level inset Jun 30, 2026
Copilot AI requested a review from alexr00 June 30, 2026 09:39
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.

The "folder" ThemeIcon causes incorrect tree level inset

2 participants