Skip emulator setup if preLaunchTask chain includes mention of them#4959
Skip emulator setup if preLaunchTask chain includes mention of them#4959MicroFish91 wants to merge 11 commits intomainfrom
preLaunchTask chain includes mention of them#4959Conversation
There was a problem hiding this comment.
Pull request overview
This PR aims to reduce redundant emulator prompts during debugging by detecting when a launch configuration’s preLaunchTask chain already includes an emulator-start task, and then skipping parts of the extension’s emulator-related pre-debug setup.
Changes:
- Add
getPreLaunchTaskChainhelper to resolvepreLaunchTask→dependsOnchains fromtasks.json. - Add detection logic in
preDebugValidateto infer whether emulators are already handled by tasks and emit telemetry (hasEmulatorTask). - Conditionally skip parts of pre-debug validation based on the detected task chain.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/debug/validatePreDebug.ts | Detects emulator-related preLaunch tasks and conditionally skips pre-debug validation steps. |
| src/debug/getPreLaunchTaskChain.ts | New utility to traverse tasks.json task dependencies to build a task chain. |
preLaunchTask chain includes mention of starting emulatorspreLaunchTask chain includes mention of them
There was a problem hiding this comment.
This function seems to be a great candidate for unit tests
|
We may want to wait on merging this until after the next release |
There was a problem hiding this comment.
Pull request overview
This PR reduces unnecessary emulator setup prompts during debug by detecting emulator-related tasks in the configured preLaunchTask dependency chain and skipping emulator-related pre-debug validation unless explicitly overridden by a new setting.
Changes:
- Added
getPreLaunchTaskChainutility to resolvepreLaunchTask→dependsOntask chains fromtasks.json. - Updated pre-debug validation to optionally skip emulator/storage validation when the task chain appears to handle emulator startup.
- Introduced
azureFunctions.forceEmulatorValidationsetting to override the skip behavior.
Show a summary per file
| File | Description |
|---|---|
src/debug/validatePreDebug.ts |
Detects emulator-related tasks in preLaunchTask chain and conditionally skips emulator/storage validation; adds telemetry + override setting read. |
src/debug/getPreLaunchTaskChain.ts |
New helper to resolve preLaunchTask dependency chains from tasks.json tasks. |
test/getPreLaunchTaskChain.test.ts |
Adds unit tests covering task-chain resolution, including cycles and invalid dependsOn entries. |
package.json |
Adds new configuration key azureFunctions.forceEmulatorValidation. |
package.nls.json |
Adds localized description string for the new setting. |
Copilot's findings
- Files reviewed: 5/5 changed files
- Comments generated: 3
| projectPath?: string; | ||
| } | ||
|
|
||
| const emulatorTaskRegExp: RegExp = /azurite|emulator/i; |
There was a problem hiding this comment.
Worried this could be pretty fragile
Users may already have their own tasks set up to launch all required emulators. In those cases, our extension can still prompt them to start emulators manually, which is kind of annoying. I'm seeing this with Copilot on Rails local-dev testing, where the task chain eventually starts the emulators, but they aren’t running yet during pre-validation and so the extension's pre-validation check triggers unwanted modals to still appear.