GitHub - add "Open on GitHub" to blame hover (#237514)

* WIP - saving my work

* Refactor hover rendering code
This commit is contained in:
Ladislau Szomoru
2025-01-08 20:34:54 +01:00
committed by GitHub
parent 1329d03879
commit dca80ea667
11 changed files with 147 additions and 57 deletions

View File

@@ -3,7 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { QuickPickItem, window, QuickPick, QuickPickItemKind, l10n, Disposable } from 'vscode';
import { QuickPickItem, window, QuickPick, QuickPickItemKind, l10n, Disposable, Command } from 'vscode';
import { RemoteSourceProvider, RemoteSource, PickRemoteSourceOptions, PickRemoteSourceResult, RemoteSourceAction } from './api/git-base';
import { Model } from './model';
import { throttle, debounce } from './decorators';
@@ -123,6 +123,20 @@ export async function getRemoteSourceActions(model: Model, url: string): Promise
return remoteSourceActions;
}
export async function getRemoteSourceControlHistoryItemCommands(model: Model, url: string): Promise<Command[]> {
const providers = model.getRemoteProviders();
const remoteSourceCommands = [];
for (const provider of providers) {
const providerCommands = await provider.getRemoteSourceControlHistoryItemCommands?.(url);
if (providerCommands?.length) {
remoteSourceCommands.push(...providerCommands);
}
}
return remoteSourceCommands;
}
export async function pickRemoteSource(model: Model, options: PickRemoteSourceOptions & { branch?: false | undefined }): Promise<string | undefined>;
export async function pickRemoteSource(model: Model, options: PickRemoteSourceOptions & { branch: true }): Promise<PickRemoteSourceResult | undefined>;
export async function pickRemoteSource(model: Model, options: PickRemoteSourceOptions = {}): Promise<string | PickRemoteSourceResult | undefined> {