()
| 143 | } |
| 144 | |
| 145 | private async loadCache() { |
| 146 | if (!this.cachePath) return; |
| 147 | |
| 148 | try { |
| 149 | const cacheContent = await vscode.workspace.fs.readFile(this.cachePath); |
| 150 | const parsed = JSON.parse(cacheContent.toString()); |
| 151 | |
| 152 | if (parsed.version === CACHE_VERSION) { |
| 153 | this.files = parsed.files || {}; |
| 154 | this.crossFileEdges = parsed.crossFileEdges || []; |
| 155 | this.workflows = parsed.workflows || {}; |
| 156 | } else { |
| 157 | // Different version - start fresh |
| 158 | console.log(`Cache version ${parsed.version} → ${CACHE_VERSION}, clearing cache`); |
| 159 | this.files = {}; |
| 160 | this.crossFileEdges = []; |
| 161 | this.workflows = {}; |
| 162 | } |
| 163 | } catch (error) { |
| 164 | this.files = {}; |
| 165 | this.crossFileEdges = []; |
| 166 | this.workflows = {}; |
| 167 | } |
| 168 | } |
| 169 | |
| 170 | private scheduleSave() { |
| 171 | const now = Date.now(); |
no test coverage detected