Skip to content

Detect extension-sourced items in provider path for correct grouping#308115

Merged
joshspicer merged 2 commits intomainfrom
josh/provider-api-tweaks-3
Apr 7, 2026
Merged

Detect extension-sourced items in provider path for correct grouping#308115
joshspicer merged 2 commits intomainfrom
josh/provider-api-tweaks-3

Conversation

@joshspicer
Copy link
Copy Markdown
Member

@joshspicer joshspicer commented Apr 7, 2026

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 uses extractExtensionIdFromPath() to detect extension directories by finding extensions in 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#7330

  • Make built-in and extension items read-only in provider path — Provider-path items with groupKey: 'builtin' had no storage set, so the delete action's when-clause didn't hide the delete button. Now uses storage ?? groupKey for the context key overlay, so built-in and extension items correctly suppress delete/modify actions. Fixes microsoft/vscode-internalbacklog#7330

Copilot AI review requested due to automatic review settings April 7, 2026 00:37
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 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 _inferStorageAndGroup to detect .../extensions/<extId>-<version>/... and classify items as PromptsStorage.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, _inferStorageAndGroup returns only { groupKey: BUILTIN_STORAGE } and leaves storage undefined. In the provider path that means AI_CUSTOMIZATION_ITEM_STORAGE_KEY is 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. Keep storage as PromptsStorage.extension while overriding grouping via groupKey (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
@joshspicer joshspicer force-pushed the josh/provider-api-tweaks-3 branch from 6831765 to 42170f3 Compare April 7, 2026 00:53
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
@joshspicer joshspicer force-pushed the josh/provider-api-tweaks-3 branch from 42170f3 to b726e38 Compare April 7, 2026 00:59
@joshspicer joshspicer marked this pull request as ready for review April 7, 2026 01:04
@joshspicer joshspicer added the ~release-cherry-pick Trigger: cherry-pick this PR to the latest release branch label Apr 7, 2026
@joshspicer joshspicer enabled auto-merge (squash) April 7, 2026 01:06
@joshspicer joshspicer merged commit 4f71da1 into main Apr 7, 2026
19 checks passed
@joshspicer joshspicer deleted the josh/provider-api-tweaks-3 branch April 7, 2026 01:33
@vs-code-engineering vs-code-engineering bot added this to the 1.114.0 milestone Apr 7, 2026
@vs-code-engineering vs-code-engineering bot added release-cherry-pick Automated cherry-pick between release and main branches and removed ~release-cherry-pick Trigger: cherry-pick this PR to the latest release branch labels Apr 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release-cherry-pick Automated cherry-pick between release and main branches

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants