提交 ec1c4aea 编写于 作者: J Joao Moreno

git api: expose repositories

上级 cc5e8c15
......@@ -44,5 +44,9 @@ export class ApiImpl implements GitExtension.API {
return mapEvent(this._model.onDidCloseRepository, r => new ApiRepository(r));
}
get repositories(): GitExtension.Repository[] {
return this._model.repositories.map(r => new ApiRepository(r));
}
constructor(private _model: Model) { }
}
......@@ -9,6 +9,7 @@ declare module GitExtension {
export interface API {
readonly gitPath: string;
readonly repositories: Repository[];
readonly onDidOpenRepository: Event<Repository>;
readonly onDidCloseRepository: Event<Repository>;
}
......@@ -24,8 +25,27 @@ declare module GitExtension {
}
export interface GitExtension {
/**
* Returns the latest available API compatible with the
* provided version range.
*
* @param range Semver version range for API compatibility.
* @returns API instance
*/
getAPI(range: string): GitExtension.API;
/**
* Returns the collection of active repositories.
*
* @deprecated Use `API.repositories` instead.
*/
getRepositories(): Promise<GitExtension.Repository[]>;
/**
* Returns the path to the current git executable.
*
* @deprecated Use `API.gitPath` instead.
*/
getGitPath(): Promise<string>;
// export const availableVersions: string[];
getAPI(range: string): GitExtension.API;
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册