Path: blob/main/extensions/git/src/typings/git-base.d.ts
3320 views
/*---------------------------------------------------------------------------------------------1* Copyright (c) Microsoft Corporation. All rights reserved.2* Licensed under the MIT License. See License.txt in the project root for license information.3*--------------------------------------------------------------------------------------------*/45import { Command, Disposable, Event, ProviderResult } from 'vscode';6export { ProviderResult } from 'vscode';78export interface API {9registerRemoteSourceProvider(provider: RemoteSourceProvider): Disposable;10getRemoteSourceActions(url: string): Promise<RemoteSourceAction[]>;11pickRemoteSource(options: PickRemoteSourceOptions): Promise<string | PickRemoteSourceResult | undefined>;12}1314export interface GitBaseExtension {1516readonly enabled: boolean;17readonly onDidChangeEnablement: Event<boolean>;1819/**20* Returns a specific API version.21*22* Throws error if git-base extension is disabled. You can listed to the23* [GitBaseExtension.onDidChangeEnablement](#GitBaseExtension.onDidChangeEnablement)24* event to know when the extension becomes enabled/disabled.25*26* @param version Version number.27* @returns API instance28*/29getAPI(version: 1): API;30}3132export interface PickRemoteSourceOptions {33readonly providerLabel?: (provider: RemoteSourceProvider) => string;34readonly urlLabel?: string | ((url: string) => string);35readonly providerName?: string;36readonly title?: string;37readonly placeholder?: string;38readonly branch?: boolean; // then result is PickRemoteSourceResult39readonly showRecentSources?: boolean;40}4142export interface PickRemoteSourceResult {43readonly url: string;44readonly branch?: string;45}4647export interface RemoteSourceAction {48readonly label: string;49/**50* Codicon name51*/52readonly icon: string;53run(branch: string): void;54}5556export interface RemoteSource {57readonly name: string;58readonly description?: string;59readonly detail?: string;60/**61* Codicon name62*/63readonly icon?: string;64readonly url: string | string[];65}6667export interface RecentRemoteSource extends RemoteSource {68readonly timestamp: number;69}7071export interface RemoteSourceProvider {72readonly name: string;73/**74* Codicon name75*/76readonly icon?: string;77readonly label?: string;78readonly placeholder?: string;79readonly supportsQuery?: boolean;8081getBranches?(url: string): ProviderResult<string[]>;82getRemoteSourceActions?(url: string): ProviderResult<RemoteSourceAction[]>;83getRecentRemoteSources?(query?: string): ProviderResult<RecentRemoteSource[]>;84getRemoteSources(query?: string): ProviderResult<RemoteSource[]>;85}868788