Skip to content

agentPlugins: allow root dir source#304611

Merged
connor4312 merged 6 commits intomainfrom
connor4312/fix-plugin-root
Mar 26, 2026
Merged

agentPlugins: allow root dir source#304611
connor4312 merged 6 commits intomainfrom
connor4312/fix-plugin-root

Conversation

@connor4312
Copy link
Copy Markdown
Member

No description provided.

Copilot AI review requested due to automatic review settings March 25, 2026 00:13
@connor4312 connor4312 enabled auto-merge March 25, 2026 00:13
@connor4312 connor4312 self-assigned this Mar 25, 2026
@vs-code-engineering vs-code-engineering bot added this to the 1.114.0 milestone Mar 25, 2026
TylerLeonhardt
TylerLeonhardt previously approved these changes Mar 25, 2026
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

Enables marketplace plugins to be sourced from the repository root directory by treating an empty source (and implicitly missing source) as the repo root when no pluginRoot is provided.

Changes:

  • Update plugin source resolution to allow empty source to resolve to repo root instead of undefined.
  • Adjust parsePluginSource test expectations for empty source without pluginRoot.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/vs/workbench/contrib/chat/common/plugins/pluginMarketplaceService.ts Removes the empty-source early return so repo-root sources resolve to '' (relative path).
src/vs/workbench/contrib/chat/test/common/plugins/pluginMarketplaceService.test.ts Updates the unit test to expect repo-root resolution for empty source without pluginRoot.
Comments suppressed due to low confidence (1)

src/vs/workbench/contrib/chat/common/plugins/pluginMarketplaceService.ts:786

  • After removing the empty-source special-case, resolvePluginSource will always return a string (including '' for repo root) for file URIs, so the string | undefined return type is now misleading and the resolved === undefined checks in parsePluginSource are effectively dead. Consider updating the return type/JSDoc to reflect that '' is a valid result (or reintroduce an explicit undefined outcome if callers rely on it to skip entries).
function resolvePluginSource(pluginRoot: string | undefined, source: string): string | undefined {
	const normalizedRoot = pluginRoot ? normalizeMarketplacePath(pluginRoot) : '';
	const normalizedSource = normalizeMarketplacePath(source);
	const repoRoot = URI.file('/');
	const pluginRootUri = normalizedRoot ? normalizePath(joinPath(repoRoot, normalizedRoot)) : repoRoot;

	if (normalizedRoot && (normalizedSource === normalizedRoot || normalizedSource.startsWith(`${normalizedRoot}/`))) {
		return normalizedSource;
	}

	const resolvedUri = normalizePath(joinPath(pluginRootUri, normalizedSource));
	return relativePath(repoRoot, resolvedUri) ?? undefined;

joshspicer
joshspicer previously approved these changes Mar 25, 2026
@connor4312 connor4312 merged commit 34361c9 into main Mar 26, 2026
18 checks passed
@connor4312 connor4312 deleted the connor4312/fix-plugin-root branch March 26, 2026 21:25
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.

7 participants