(messageTs: number)
| 247 | * Handles message deletion operations with user confirmation |
| 248 | */ |
| 249 | const handleDeleteOperation = async (messageTs: number): Promise<void> => { |
| 250 | // Check if there's a checkpoint before this message |
| 251 | const currentCline = provider.getCurrentTask() |
| 252 | let hasCheckpoint = false |
| 253 | |
| 254 | if (!currentCline) { |
| 255 | await vscode.window.showErrorMessage(t("common:errors.message.no_active_task_to_delete")) |
| 256 | return |
| 257 | } |
| 258 | |
| 259 | const { messageIndex } = findMessageIndices(messageTs, currentCline) |
| 260 | |
| 261 | if (messageIndex !== -1) { |
| 262 | // Find the last checkpoint before this message |
| 263 | const checkpoints = currentCline.clineMessages.filter( |
| 264 | (msg) => msg.say === "checkpoint_saved" && msg.ts > messageTs, |
| 265 | ) |
| 266 | hasCheckpoint = checkpoints.length > 0 |
| 267 | } |
| 268 | |
| 269 | // Send message to webview to show delete confirmation dialog |
| 270 | await provider.postMessageToWebview({ |
| 271 | type: "showDeleteMessageDialog", |
| 272 | messageTs, |
| 273 | hasCheckpoint, |
| 274 | }) |
| 275 | } |
| 276 | |
| 277 | /** |
| 278 | * Handles confirmed message deletion from webview dialog |
no test coverage detected