Detect extension-sourced items in provider path for correct grouping#308115
Merged
joshspicer merged 2 commits intomainfrom Apr 7, 2026
Merged
Detect extension-sourced items in provider path for correct grouping#308115joshspicer merged 2 commits intomainfrom
joshspicer merged 2 commits intomainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes mis-grouping of extension-contributed Chat Customizations when using an external provider (e.g. Copilot CLI) by inferring “Extensions” vs “Built-in” from file: URIs that point into the local extensions install directory.
Changes:
- Extend
_inferStorageAndGroupto detect.../extensions/<extId>-<version>/...and classify items asPromptsStorage.extension. - Special-case the default chat extension to group its items under Built-in instead of Extensions.
Show a summary per file
| File | Description |
|---|---|
| src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationListWidget.ts | Adds extension-install-directory detection to provider-path storage inference to group extension-sourced items correctly. |
Copilot's findings
Comments suppressed due to low confidence (1)
src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationListWidget.ts:1803
- In the built-in extension case,
_inferStorageAndGroupreturns only{ groupKey: BUILTIN_STORAGE }and leavesstorageundefined. In the provider path that meansAI_CUSTOMIZATION_ITEM_STORAGE_KEYis not set for these items, so context-menu when-clauses (e.g. deletable checks) will treat them like normal provider items and may incorrectly allow actions like Delete/Reveal/Edit. KeepstorageasPromptsStorage.extensionwhile overriding grouping viagroupKey(and/or set an explicit read-only storage key) so built-in items remain correctly treated as extension-sourced/read-only.
const versionMatch = folderName.match(/^(.+)-\d+\./);
const extensionId = versionMatch ? versionMatch[1] : folderName;
if (this.isChatExtensionItem(new ExtensionIdentifier(extensionId))) {
return { groupKey: BUILTIN_STORAGE };
}
return { storage: PromptsStorage.extension };
- Files reviewed: 1/1 changed files
- Comments generated: 1
Items from VS Code extensions (under extensions/ directory) were classified as 'user' storage because _inferStorageAndGroup only checked workspace folders, plugins, and file: scheme. Now detects extension install directories by finding 'extensions' in the path segments and extracting the extension ID from the folder name. Items from the default chat extension are classified as Built-in; items from other extensions as Extensions. This aligns the provider path grouping with how the core (Local) path handles extension-contributed skills, agents, and other items. Fixes microsoft/vscode-internalbacklog#7330
6831765 to
42170f3
Compare
Set storage alongside groupKey in _inferStorageAndGroup so that built-in items (non-file schemes, chat extension) always have PromptsStorage.extension as their storage. This ensures the delete action's when-clause correctly hides the trash icon for read-only items without needing a groupKey fallback hack. Fixes microsoft/vscode-internalbacklog#7330
42170f3 to
b726e38
Compare
justschen
approved these changes
Apr 7, 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.
Fixes extension-sourced items being misclassified in the Chat Customizations provider path (microsoft/vscode-internalbacklog#7330).
Commits
Detect extension-sourced items in provider path for correct grouping — Items from VS Code extensions (under
~/.vscode*/extensions/) were classified as "User". Now usesextractExtensionIdFromPath()to detect extension directories by findingextensionsin the path segments and extracting the extension ID (stripping the version suffix). Default chat extension items → Built-in; other extensions → Extensions. Includes unit tests (8 test cases). Fixes microsoft/vscode-internalbacklog#7330Make built-in and extension items read-only in provider path — Provider-path items with
groupKey: 'builtin'had nostorageset, so the delete action's when-clause didn't hide the delete button. Now usesstorage ?? groupKeyfor the context key overlay, so built-in and extension items correctly suppress delete/modify actions. Fixes microsoft/vscode-internalbacklog#7330