Skip to content

Fix parent folder checkbox not auto-checked when all children are marked as viewed#8615

Draft
Copilot wants to merge 4 commits intomainfrom
copilot/fix-parent-folder-checkbox-state
Draft

Fix parent folder checkbox not auto-checked when all children are marked as viewed#8615
Copilot wants to merge 4 commits intomainfrom
copilot/fix-parent-folder-checkbox-state

Conversation

Copy link
Contributor

Copilot AI commented Mar 25, 2026

With manageCheckboxStateManually: true (added in #8527), VS Code doesn't apply checkboxState changes returned from getTreeItem() during refresh(). Directory checkbox states were only computed lazily in getTreeItem(), so parent folders never visually updated when all children were individually checked.

Changes

  • DirectoryTreeNode: Made setCheckboxState public, added updateCheckboxFromChildren() to eagerly recompute state from children
  • treeUtils.ts: After updating file node states in processCheckboxUpdates, walk up from each affected node and eagerly set ancestor directory checkbox states before firing the tree refresh
// Eagerly update ancestor directory checkbox states
const allAffected = [...checkedNodes, ...uncheckedNodes];
for (const node of allAffected) {
    let parent = node.getParent();
    while (parent instanceof DirectoryTreeNode) {
        parent.updateCheckboxFromChildren();
        parent = parent.getParent();
    }
}
  • Tests: Added tests for allChildrenViewed() and updateCheckboxFromChildren() covering flat, nested, mixed, and state-transition scenarios

📱 Kick off Copilot coding agent tasks wherever you are with GitHub Mobile, available on iOS and Android.

Copilot AI and others added 3 commits March 25, 2026 18:37
…ked as viewed

Eagerly update ancestor directory checkbox states in processCheckboxUpdates
before refresh, rather than relying solely on getTreeItem() which may not
apply checkboxState changes with manageCheckboxStateManually: true.

Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com>
Agent-Logs-Url: https://github.com/microsoft/vscode-pull-request-github/sessions/0fafc95a-8baa-49ec-8f27-602e4bcf370a
Copilot AI changed the title [WIP] Fix parent folder checkbox not auto-checked when all children are viewed Fix parent folder checkbox not auto-checked when all children are marked as viewed Mar 25, 2026
Copilot AI requested a review from alexr00 March 25, 2026 18:43
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.

Parent folder checkbox not auto-checked when all children are marked as viewed

2 participants