| 124 | let cache: Entry = { files: [], dirs: [] } |
| 125 | let fetching = false |
| 126 | const fn = async (result: Entry) => { |
| 127 | fetching = true |
| 128 | const set = new Set<string>() |
| 129 | for await (const file of Ripgrep.files({ cwd: Instance.directory })) { |
| 130 | result.files.push(file) |
| 131 | let current = file |
| 132 | while (true) { |
| 133 | const dir = path.dirname(current) |
| 134 | if (dir === ".") break |
| 135 | if (dir === current) break |
| 136 | current = dir |
| 137 | if (set.has(dir)) continue |
| 138 | set.add(dir) |
| 139 | result.dirs.push(dir + "/") |
| 140 | } |
| 141 | } |
| 142 | cache = result |
| 143 | fetching = false |
| 144 | } |
| 145 | fn(cache) |
| 146 | |
| 147 | return { |