* Handle file rename
(file: TFile, oldPath: string)
| 223 | * Handle file rename |
| 224 | */ |
| 225 | private handleFileRenamed(file: TFile, oldPath: string): void { |
| 226 | const pendingTaskInfo = this.pendingTaskInfoByPath.get(oldPath); |
| 227 | if (pendingTaskInfo) { |
| 228 | this.pendingTaskInfoByPath.delete(oldPath); |
| 229 | this.pendingTaskInfoByPath.set(file.path, { |
| 230 | ...pendingTaskInfo, |
| 231 | id: file.path, |
| 232 | path: file.path, |
| 233 | }); |
| 234 | } |
| 235 | |
| 236 | // Cancel any pending debounced handlers for old path |
| 237 | const timeoutId = this.debouncedHandlers.get(oldPath); |
| 238 | if (timeoutId) { |
| 239 | window.clearTimeout(timeoutId); |
| 240 | this.debouncedHandlers.delete(oldPath); |
| 241 | } |
| 242 | this.removeFilterIndexEntry(oldPath); |
| 243 | this.updateFilterIndexesForFile(file.path, this.app.metadataCache.getFileCache(file)); |
| 244 | |
| 245 | this.trigger("file-renamed", { oldPath, newPath: file.path, file }); |
| 246 | this.trigger("data-changed"); |
| 247 | } |
| 248 | |
| 249 | /** |
| 250 | * Check if a file path is valid for inclusion |
no test coverage detected