Skip to content

Commit e2c17e4

Browse files
nrjdalalclaude
andcommitted
fix: expand parent folders when jumping to symlink target
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent c4851f0 commit e2c17e4

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

bin/utils/interactive-picker.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -582,9 +582,16 @@ export function interactivePicker(
582582
} else if (item && item.node.type === "symlink" && item.node.linkTarget.endsWith("/")) {
583583
// Symlink to folder - resolve relative path and jump to target
584584
const targetPath = resolveSymlinkPath(item.node.path, item.node.linkTarget)
585+
// Expand all ancestors so target is visible
586+
const pathParts = targetPath.split("/")
587+
for (let pi = 1; pi <= pathParts.length; pi++) {
588+
const ancestorPath = pathParts.slice(0, pi).join("/")
589+
const ancestor = findNodeByPath(tree, ancestorPath)
590+
if (ancestor && ancestor.type === "tree") ancestor.expanded = true
591+
}
585592
const targetNode = findNodeByPath(tree, targetPath)
586593
if (targetNode) {
587-
targetNode.expanded = true
594+
if (targetNode.type === "tree") targetNode.expanded = true
588595
const updatedItems = flatten(tree)
589596
const targetIdx = updatedItems.findIndex((fi) => fi.node === targetNode)
590597
if (targetIdx >= 0) cursor = targetIdx + 1 // +1 for dot row

0 commit comments

Comments
 (0)