Skip to content

Skip emulator setup if preLaunchTask chain includes mention of them#4959

Open
MicroFish91 wants to merge 11 commits intomainfrom
mwf/debug-dont-prompt
Open

Skip emulator setup if preLaunchTask chain includes mention of them#4959
MicroFish91 wants to merge 11 commits intomainfrom
mwf/debug-dont-prompt

Conversation

@MicroFish91
Copy link
Copy Markdown
Contributor

@MicroFish91 MicroFish91 commented Apr 3, 2026

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.

Copilot AI review requested due to automatic review settings April 3, 2026 00:41
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 getPreLaunchTaskChain helper to resolve preLaunchTaskdependsOn chains from tasks.json.
  • Add detection logic in preDebugValidate to 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.

Comment thread src/debug/validatePreDebug.ts Outdated
Comment thread src/debug/validatePreDebug.ts Outdated
Comment thread src/debug/getPreLaunchTaskChain.ts
@MicroFish91 MicroFish91 changed the title Skip emulator setup if preLaunchTask chain includes mention of starting emulators Skip emulator setup if preLaunchTask chain includes mention of them Apr 3, 2026
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function seems to be a great candidate for unit tests

@MicroFish91 MicroFish91 marked this pull request as ready for review April 3, 2026 19:22
@MicroFish91 MicroFish91 requested a review from a team as a code owner April 3, 2026 19:22
@MicroFish91 MicroFish91 enabled auto-merge (squash) April 3, 2026 19:30
@MicroFish91 MicroFish91 disabled auto-merge April 3, 2026 19:31
@MicroFish91
Copy link
Copy Markdown
Contributor Author

MicroFish91 commented Apr 3, 2026

We may want to wait on merging this until after the next release

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 getPreLaunchTaskChain utility to resolve preLaunchTaskdependsOn task chains from tasks.json.
  • Updated pre-debug validation to optionally skip emulator/storage validation when the task chain appears to handle emulator startup.
  • Introduced azureFunctions.forceEmulatorValidation setting 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

Comment thread src/debug/validatePreDebug.ts Outdated
Comment thread src/debug/getPreLaunchTaskChain.ts
Comment thread test/getPreLaunchTaskChain.test.ts
projectPath?: string;
}

const emulatorTaskRegExp: RegExp = /azurite|emulator/i;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Worried this could be pretty fragile

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants