fix: avoid activating Java during debug configuration discovery - #1704
Merged
Merged
Conversation
wenyt (wenytang-ms)
requested review from
Changyong Gong (chagong),
Sheng Chen (jdneo) and
Jinbo Wang (testforstephen)
as code owners
September 24, 2026 05:27
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The implementation matches the reported activation issue and includes focused lifecycle and regression coverage.
Review effort: Balanced
Findings: None
What changed in this PR
Prevents Java activation from blocking debug configuration discovery in non-Java workspaces.
Changes:
- Adds passive, disposable Java activation observation.
- Updates No-Config, stack-trace, and source-invalidation integrations.
- Fixes activation rejection/cancellation handling and adds regression coverage.
| File | Description |
|---|---|
src/utility.ts |
Adds passive activation observation and fixes promise handling. |
src/noConfigDebugInit.ts |
Removes Java activation from terminal preparation. |
src/stackTraceLinkProvider.ts |
Defers link registration until natural Java activation. |
src/extension.ts |
Uses owned passive source-invalidation subscription. |
test/javaExtensionAPI.test.ts |
Covers rejection and cancellation behavior. |
test/javaDebugActivation.test.ts |
Verifies non-Java activation remains unblocked. |
test/noConfigDebugStorage.test.ts |
Covers deferred executable discovery and disposal. |
README.md |
Documents deferred Java executable discovery. |
bundled/scripts/noConfigScripts/README.md |
Documents wrapper behavior and selection order. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Changyong Gong (chagong)
approved these changes
Sep 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #1703.
Keep debug configuration discovery in non-Java workspaces from starting or waiting for
redhat.java. This is a focused fix based on currentmain, independent of #1696's background-initialization and AI-readiness redesign.Cause
VS Code can activate this extension through the global
onDebugInitialConfigurationsevent. Two startup paths then unnecessarily activate Java:getJavaHome()before activation can complete.getJavaExtensionAPI()even without a Java file.Additionally, the async Promise executor in
getJavaExtensionAPI()loses activation rejections, leaving the outer promise pending instead of reaching callers' error handlers. This provides a failure path consistent with the reported JDK prompt and stuck extension activation; the reporter's exact Java startup failure is not yet confirmed.Changes
isActive, never callsactivate(), and stops after delivery/error or disposal. It checks once per second while waiting because VS Code has no public extension-activation event.VSCODE_JAVA_EXECdiscovery and stack-trace links. Preserve stack-trace Standard-mode gating and support Java opening later in the same window.Existing terminals need recreation to receive a Java executable discovered later. Explicit Java Run/Debug continues to activate Java normally.
Validation
npm run compile.Java-extension behavior and registration boundaries are stubbed in the activation test; it does not claim reporter-environment reproduction, an automated picker UI test, or a real JVM attach. No dependency, manifest activation-event, AI-readiness, or endpoint-protocol redesign is included.