Include debounce, + better handling of disposals and overlapped triggers. Fixes #5621
Pull Request Overview
This PR implements proper handling of file modifications to the autolaunch file by adding debouncing functionality and better management of disposals and overlapped triggers.
- Adds debouncing to prevent excessive processing when autolaunch files are rapidly modified
- Improves disposal handling to prevent operations from continuing after the AutoLaunch instance has been disposed
- Adds a processing queue to prevent overlapping async operations
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/shared/vscode/autolaunch.ts | Implements debounced file change handling, disposal safety checks, and a processing queue to prevent overlapped operations |
| src/test/dart/debug/autolaunch.test.ts | Adds comprehensive tests for file modification scenarios including debouncing behavior and refactors helper functions |
src/test/dart/debug/autolaunch.test.ts:74
- The test directly uses fs.promises.writeFile instead of the writeAutoLaunch helper function that's used elsewhere in the test. This creates inconsistency and makes the test harder to maintain. Consider using writeAutoLaunch(filePath, launchConfig1) for consistency.
await fs.promises.writeFile(filePath, JSON.stringify({ configurations: [launchConfig1] }));