mirror of
https://github.com/microsoft/vscode.git
synced 2026-02-28 05:35:08 +00:00
* Allow custom title in remote source picker * Include forks in query search results * Support `RemoteSource.detail` * Allow showing quickpicks in `getRemoteSources` * Allow custom placeholder and remote source icons * Add ability to customize placeholder * Register and show recently opened sources * Allow custom remote url labels * Add a separator label for remote sources * Update git-base typings * Make showing recent sources opt in * Add concept of recent remote source to `RemoteSourceProvider` concept * Recent sources should be sorted by timestamp * Pass current query to `getRemoteSources` * Fix applying query
76 lines
2.3 KiB
TypeScript
76 lines
2.3 KiB
TypeScript
/*---------------------------------------------------------------------------------------------
|
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
*--------------------------------------------------------------------------------------------*/
|
|
|
|
import { Disposable, Event, ProviderResult, Uri } from 'vscode';
|
|
export { ProviderResult } from 'vscode';
|
|
|
|
export interface API {
|
|
registerRemoteSourceProvider(provider: RemoteSourceProvider): Disposable;
|
|
pickRemoteSource(options: PickRemoteSourceOptions): Promise<string | PickRemoteSourceResult | undefined>;
|
|
}
|
|
|
|
export interface GitBaseExtension {
|
|
|
|
readonly enabled: boolean;
|
|
readonly onDidChangeEnablement: Event<boolean>;
|
|
|
|
/**
|
|
* Returns a specific API version.
|
|
*
|
|
* Throws error if git-base extension is disabled. You can listed to the
|
|
* [GitBaseExtension.onDidChangeEnablement](#GitBaseExtension.onDidChangeEnablement)
|
|
* event to know when the extension becomes enabled/disabled.
|
|
*
|
|
* @param version Version number.
|
|
* @returns API instance
|
|
*/
|
|
getAPI(version: 1): API;
|
|
}
|
|
|
|
export interface PickRemoteSourceOptions {
|
|
readonly providerLabel?: (provider: RemoteSourceProvider) => string;
|
|
readonly urlLabel?: string | ((url: string) => string);
|
|
readonly providerName?: string;
|
|
readonly title?: string;
|
|
readonly placeholder?: string;
|
|
readonly branch?: boolean; // then result is PickRemoteSourceResult
|
|
readonly showRecentSources?: boolean;
|
|
}
|
|
|
|
export interface PickRemoteSourceResult {
|
|
readonly url: string;
|
|
readonly branch?: string;
|
|
}
|
|
|
|
export interface RemoteSource {
|
|
readonly name: string;
|
|
readonly description?: string;
|
|
readonly detail?: string;
|
|
/**
|
|
* Codicon name
|
|
*/
|
|
readonly icon?: string;
|
|
readonly url: string | string[];
|
|
}
|
|
|
|
export interface RecentRemoteSource extends RemoteSource {
|
|
readonly timestamp: number;
|
|
}
|
|
|
|
export interface RemoteSourceProvider {
|
|
readonly name: string;
|
|
/**
|
|
* Codicon name
|
|
*/
|
|
readonly icon?: string;
|
|
readonly label?: string;
|
|
readonly placeholder?: string;
|
|
readonly supportsQuery?: boolean;
|
|
|
|
getBranches?(url: string): ProviderResult<string[]>;
|
|
getRecentRemoteSources?(query?: string): ProviderResult<RecentRemoteSource[]>;
|
|
getRemoteSources(query?: string): ProviderResult<RemoteSource[]>;
|
|
}
|