VS Code Git Extension API

后端 未结 2 393
旧巷少年郎
旧巷少年郎 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:51

    You can have a look at eamodio/vscode-gitlens, the main extension based on Git extension.

    Its src/git/gitService.ts does call the GIt extension:

    static async getBuiltInGitApi(): Promise {
        try {
            const extension = extensions.getExtension('vscode.git') as Extension;
            if (extension !== undefined) {
                const gitExtension = extension.isActive ? extension.exports : await extension.activate();
    
                return gitExtension.getAPI(1);
            }
        } catch {}
    
        return undefined;
    }
    

提交回复
热议问题