-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathextension.js
49 lines (42 loc) · 1.12 KB
/
extension.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
const { setupGitMob } = require("./src/setup-git-mob");
const { GitExt } = require("./src/vscode-git-extension/git-ext");
const { waitForRepos } = require("./src/wait-for-repos");
const {
installGitCoAuthorFile,
} = require("./src/install/install-git-coauthor-file");
const { logIssue } = require("./src/errors/log-issue");
let isReady = false;
async function activate(context) {
try {
await installGitCoAuthorFile();
} catch (error) {
logIssue(
`Extension Activate: Oops something went wrong creating co-author file. Error: ${error.message}`
);
}
const gitExt = new GitExt();
waitForRepos(gitExt, () => {
isReady = true;
setupGitMob(context, gitExt);
});
}
exports.activate = activate;
function deactivate() {}
exports.deactivate = deactivate;
function ready() {
return new Promise((resolve, reject) => {
retry(1, resolve, reject);
});
}
function retry(count, resolve, reject) {
if (isReady) {
resolve("git-mob ready");
}
if (count >= 10) {
reject("git-mob failed");
}
setTimeout(function () {
retry(count + 1, resolve, reject);
}, 200);
}
exports.ready = ready;