| 216 | } |
| 217 | |
| 218 | const buildTreeNodeIndex = (root: FileTreeNode): Map<string, FileTreeNode> => { |
| 219 | const nodeIndex = new Map<string, FileTreeNode>(); |
| 220 | |
| 221 | const visit = (node: FileTreeNode, currentPath: string) => { |
| 222 | nodeIndex.set(currentPath, node); |
| 223 | for (const child of node.children) { |
| 224 | visit(child, joinTreePath(currentPath, child.name)); |
| 225 | } |
| 226 | }; |
| 227 | |
| 228 | visit(root, ''); |
| 229 | return nodeIndex; |
| 230 | } |
| 231 | |
| 232 | const sortTreeEntries = (entries: ListTreeEntry[]): ListTreeEntry[] => { |
| 233 | const collator = new Intl.Collator(undefined, { sensitivity: 'base' }); |