VS Code Git Extension API

后端 未结 2 394
旧巷少年郎
旧巷少年郎 2021-01-07 00:52

Is there somewhere one can obtain more documentation on how to create an extension that uses the Git Extension API?

At https://github.com/microsoft/vscode/blob/maste

2条回答
  •  臣服心动
    2021-01-07 01:35

    To further complement the existing answer, and for those who do not code in TypeScript but raw JavaScript:

    A call to gitExtension.getAPI(1) will give you an instance of API that is only useful for its .repositories member. This member is an array of Repository instances, one for each of your workspace repo. From such instances, you can do all git actions.

    However, I must admit that this API is still poorly documented, as most functions accept strings, and it's not always obvious what they should be if you are not familiar with git language. I ended up using simple-git node module. It has proper documentation and is faster to achieve the functionality you want without losing too much time here.

提交回复
热议问题