Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,11 @@ class InstallFromSourceAction extends Action2 {
});
}

async run(accessor: ServicesAccessor): Promise<void> {
async run(accessor: ServicesAccessor, args?: { source?: string; sha?: string }): Promise<void> {
const quickInputService = accessor.get(IQuickInputService);
const pluginInstallService = accessor.get(IPluginInstallService);

const source = await quickInputService.input({
const source = args?.source ?? await quickInputService.input({
placeHolder: localize('pluginSourcePlaceholder', "owner/repo or git clone URL"),
prompt: localize('pluginSourcePrompt', "Enter a GitHub repository or git URL to install a plugin from"),
});
Expand All @@ -73,7 +73,7 @@ class InstallFromSourceAction extends Action2 {
return;
}

await pluginInstallService.installPluginFromSource(source.trim());
await pluginInstallService.installPluginFromSource(source.trim(), args?.sha);
Comment on lines 63 to +76
}
}

Expand Down
6 changes: 3 additions & 3 deletions src/vs/workbench/contrib/chat/browser/pluginInstallService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export class PluginInstallService implements IPluginInstallService {
return this._installGitPlugin(plugin);
}

async installPluginFromSource(source: string): Promise<void> {
async installPluginFromSource(source: string, sha?: string): Promise<void> {
const reference = parseMarketplaceReference(source);
if (!reference) {
this._notificationService.notify({
Expand All @@ -75,8 +75,8 @@ export class PluginInstallService implements IPluginInstallService {

// Build a source descriptor for the git clone.
const sourceDescriptor = reference.kind === MarketplaceReferenceKind.GitHubShorthand
? { kind: PluginSourceKind.GitHub as const, repo: reference.githubRepo! }
: { kind: PluginSourceKind.GitUrl as const, url: reference.cloneUrl };
? { kind: PluginSourceKind.GitHub as const, repo: reference.githubRepo!, sha }
: { kind: PluginSourceKind.GitUrl as const, url: reference.cloneUrl, sha };

Comment on lines 58 to 80
// Build a temporary plugin object for the trust gate and clone step.
const tempPlugin: IMarketplacePlugin = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,11 @@ export interface IPluginInstallService {
* GitHub shorthand (`owner/repo`) or a full git clone URL. Clones the
* repository, reads marketplace metadata to discover plugins, and
* registers the selected plugin.
*
* @param source A GitHub shorthand (`owner/repo`) or full git clone URL.
* @param sha Optional commit SHA to pin the installation to a specific revision.
*/
installPluginFromSource(source: string): Promise<void>;
installPluginFromSource(source: string, sha?: string): Promise<void>;

/**
* Pulls the latest changes for an already-cloned marketplace repository.
Expand Down
Loading