add some logs

This commit is contained in:
2021-12-07 15:02:14 +03:00
parent 3560e9f93b
commit fdd72009b9

View File

@@ -8,6 +8,7 @@ export async function activate() {
const email = conf.get<string>("email"); const email = conf.get<string>("email");
if (!vscode.workspace.workspaceFolders) { if (!vscode.workspace.workspaceFolders) {
console.log("No opened workspace");
return; return;
} }
@@ -19,12 +20,14 @@ export async function activate() {
const gitExt = vscode.extensions.getExtension<GitExtension>('vscode.git')!; const gitExt = vscode.extensions.getExtension<GitExtension>('vscode.git')!;
const git = gitExt.exports.getAPI(1); const git = gitExt.exports.getAPI(1);
if (!git) { if (!git) {
console.log("Git extension disabled");
return; return;
} }
const repository = await git.openRepository(vscode.workspace.workspaceFolders[0].uri); const repository = await git.openRepository(vscode.workspace.workspaceFolders[0].uri);
if (!repository) { if (!repository) {
console.error("Cannot open git repository");
return; return;
} }
@@ -38,6 +41,7 @@ export async function activate() {
return elem.key === "user.name" || elem.key === "user.email"; return elem.key === "user.name" || elem.key === "user.email";
}); });
if (gitConfig.length === 0) { if (gitConfig.length === 0) {
console.error("Missing user creds in git");
vscode.window.showErrorMessage("Missing user creds in git"); vscode.window.showErrorMessage("Missing user creds in git");
return; return;
} }
@@ -56,7 +60,7 @@ export async function activate() {
} }
}); });
if (gitName !== name || gitEmail !== email) { if (gitName !== name || gitEmail !== email) {
vscode.window.showErrorMessage("Wrong user creds in git"); console.error("Wrong user settings in git");
} }
} }
}); });