| 891 | } |
| 892 | |
| 893 | function ensureLevel(levels: Map<string, TreeLevel>, path: string): TreeLevel { |
| 894 | const existing = levels.get(path); |
| 895 | if (existing !== undefined) { |
| 896 | return existing; |
| 897 | } |
| 898 | const created: TreeLevel = { |
| 899 | path, |
| 900 | files: 0, |
| 901 | symbols: 0, |
| 902 | children: [], |
| 903 | foldedDuplicates: 0, |
| 904 | droppedNonPaths: 0, |
| 905 | synthetic: true, |
| 906 | }; |
| 907 | levels.set(path, created); |
| 908 | return created; |
| 909 | } |
| 910 | |
| 911 | function graftPath(levels: Map<string, TreeLevel>, path: string, kind: 'file' | 'dir'): void { |
| 912 | const parent = parentPath(path); |