Use watcher for test dicovery to catch modifications outside of VS Code#5696
Use watcher for test dicovery to catch modifications outside of VS Code#5696
Conversation
The `vs.workspace.onDidXXX` events only fire for changes in the VS Code UI so we don't detect test changes made externally. This changes to use the watcher instead. Fixes #5693
There was a problem hiding this comment.
Pull Request Overview
Replaces VS Code workspace events with a file system watcher to detect test file changes made outside of the VS Code UI. This ensures test discovery captures modifications like file creation, deletion, and renaming that occur through external editors or filesystem operations.
- Replaced
vs.workspace.onDidXXXevents withvs.workspace.createFileSystemWatcher - Added test cases to verify file creation, deletion, and renaming behavior
- Simplified file handling logic by removing rename event processing
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/test/dart/test/test_discovery.test.ts | Added comprehensive test cases for filesystem operations including create/delete and rename scenarios |
| src/extension/lsp/test_discoverer.ts | Replaced workspace events with file system watcher for external change detection |
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request correctly replaces the use of vs.workspace.onDid... events with a FileSystemWatcher for test discovery, which will allow detecting file changes made outside of the VS Code UI. The implementation is clean, handling file creation, deletion, and renames appropriately. The new tests are comprehensive and correctly verify the new functionality using direct file system operations. The changes look solid and ready to merge.
There was a problem hiding this comment.
Codex Review: Here are some suggestions.
Reply with @codex fix comments to fix any unresolved comments.
About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you open a pull request for review, mark a draft as ready, or comment "@codex review". If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex fix this CI failure" or "@codex address that feedback".
The
vs.workspace.onDidXXXevents only fire for changes in the VS Code UI so we don't detect test changes made externally. This changes to use the watcher instead.Fixes #5693