GitHub - link provider for various hovers (#237961)

* Initial implementation

* Refactor code, add link to blame decoration

* Add links to timeline hover

* Saving my work

* Update remote order for "Open on GitHub" action

* Bug fixes

* Add link provider for graph hover

* Rename method
This commit is contained in:
Ladislau Szomoru
2025-01-15 16:30:43 +01:00
committed by GitHub
parent 96e03e0d94
commit 57e8c28877
15 changed files with 142 additions and 46 deletions

View File

@@ -5,7 +5,7 @@
import { Command, Disposable, commands } from 'vscode';
import { Model } from '../model';
import { getRemoteSourceActions, getRemoteSourceControlHistoryItemCommands, pickRemoteSource } from '../remoteSource';
import { getRemoteSourceActions, getRemoteSourceControlHistoryItemCommands, pickRemoteSource, provideRemoteSourceLinks } from '../remoteSource';
import { GitBaseExtensionImpl } from './extension';
import { API, PickRemoteSourceOptions, PickRemoteSourceResult, RemoteSourceAction, RemoteSourceProvider } from './git-base';
@@ -21,10 +21,14 @@ export class ApiImpl implements API {
return getRemoteSourceActions(this._model, url);
}
getRemoteSourceControlHistoryItemCommands(url: string): Promise<Command[]> {
getRemoteSourceControlHistoryItemCommands(url: string): Promise<Command[] | undefined> {
return getRemoteSourceControlHistoryItemCommands(this._model, url);
}
provideRemoteSourceLinks(url: string, content: string): Promise<string> {
return provideRemoteSourceLinks(this._model, url, content);
}
registerRemoteSourceProvider(provider: RemoteSourceProvider): Disposable {
return this._model.registerRemoteSourceProvider(provider);
}

View File

@@ -9,7 +9,8 @@ export { ProviderResult } from 'vscode';
export interface API {
registerRemoteSourceProvider(provider: RemoteSourceProvider): Disposable;
getRemoteSourceActions(url: string): Promise<RemoteSourceAction[]>;
getRemoteSourceControlHistoryItemCommands(url: string): Promise<Command[]>;
getRemoteSourceControlHistoryItemCommands(url: string): Promise<Command[] | undefined>;
provideRemoteSourceLinks(url: string, content: string): Promise<string | undefined>;
pickRemoteSource(options: PickRemoteSourceOptions): Promise<string | PickRemoteSourceResult | undefined>;
}
@@ -85,4 +86,5 @@ export interface RemoteSourceProvider {
getRemoteSourceControlHistoryItemCommands?(url: string): ProviderResult<Command[]>;
getRecentRemoteSources?(query?: string): ProviderResult<RecentRemoteSource[]>;
getRemoteSources(query?: string): ProviderResult<RemoteSource[]>;
provideRemoteSourceLinks?(url: string, content: string): Promise<string | undefined>;
}