extensions/github/src/extension.ts/activate
export function activate(context: ExtensionContext): void {
	const disposables = new Set<Disposable>();
	context.subscriptions.push(combinedDisposable(disposables));

	const init = () => {
		try {
			const gitAPI = gitExtension.getAPI(1);

			disposables.add(registerCommands(gitAPI));
			disposables.add(gitAPI.registerRemoteSourceProvider(new GithubRemoteSourceProvider(gitAPI)));
			disposables.add(new GithubCredentialProviderManager(gitAPI));
			disposables.add(gitAPI.registerPushErrorHandler(new GithubPushErrorHandler()));
		} catch (err) {
			console.error('Could not initialize GitHub extension');
			console.warn(err);
		}
	};

	const onDidChangeGitExtensionEnablement = (enabled: boolean) => {
		if (!enabled) {
			dispose(disposables);
			disposables.clear();
		} else {
			init();
		}
	};


	const gitExtension = extensions.getExtension<GitExtension>('vscode.git')!.exports;
	context.subscriptions.push(gitExtension.onDidChangeEnablement(onDidChangeGitExtensionEnablement));
	onDidChangeGitExtensionEnablement(gitExtension.enabled);
}