Add a when clause context key for detecting if an extension is installed+enabled - #326814
Merged
Connor Peet (connor4312) merged 7 commits intoJul 23, 2026
Conversation
Mirror the set of installed and enabled extensions into per-extension context keys (extensionEnabled:<lowercased id>) so authors can gate UI via when clauses without activating the extension. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: cb195182-bee3-4aaf-b33b-ceb8e36e3f18
…n-installed-context-key
…n-installed-context-key
Copilot started reviewing on behalf of
Brandon Waterloo [MSFT] (bwateratmsft)
July 21, 2026 14:06
View session
Contributor
There was a problem hiding this comment.
Pull request overview
Introduces per-extension context keys for gating UI based on extension presence, currently using registered/enabled extension state.
Changes:
- Adds
extensionEnabled:<id>context keys. - Updates keys when extensions change.
- Adds lifecycle registration and unit tests.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
extensionEnablementContext.ts |
Implements extension context keys. |
extensions.contribution.ts |
Registers the contribution. |
extensionEnablementContext.test.ts |
Tests initialization, updates, and ID normalization. |
Address CCR feedback: seed on onDidRegisterExtensions (extensions list is empty until initial registration, which the Restored phase does not guarantee) and reconcile against the authoritative extensionService.extensions set instead of trusting change deltas (which can report added extensions that validation later rejects due to dependency loops). Adds a regression test. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: cb195182-bee3-4aaf-b33b-ceb8e36e3f18
Connor Peet (connor4312)
approved these changes
Jul 21, 2026
Brandon Waterloo [MSFT] (bwateratmsft)
marked this pull request as ready for review
July 23, 2026 16:26
Contributor
Author
|
Verified this works end-to-end. Updating the branch to see if that fixes the build breaks, they look unrelated. Using a dummy extension with a command gated on this
|
Connor Peet (connor4312)
enabled auto-merge
July 23, 2026 19:59
Connor Peet (connor4312)
removed the request for review
from Sandeep Somavarapu (sandy081)
July 23, 2026 19:59
Megan Rogge (meganrogge)
approved these changes
Jul 23, 2026
Paul (pwang347)
approved these changes
Jul 23, 2026
roblourens
approved these changes
Jul 23, 2026
Connor Peet (connor4312)
merged commit Jul 23, 2026
7e5ad0c
into
microsoft:main
46 of 47 checks passed
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Fixes #326815.
This PR adds a when clause context key for detecting if an extension is installed+enabled. This is useful in cases where you want to hide something (e.g. a duplicate view or command, etc.), but do not control the other extension, or do not want to rely on it being activated first.
Submitting as a draft for now, due to ongoing feed issues I cannot actually do
npm installlocally.