Compare commits

...

2 Commits

3 changed files with 11 additions and 9 deletions

1
LICENSE.md Normal file
View File

@ -0,0 +1 @@
soak

View File

@ -6,6 +6,10 @@
"categories": [
"Other"
],
"repository": {
"type": "git",
"url": "ssh://git@gitea.raphaelpiccolo.com:10022/root/vscodestat.git"
},
"main": "./out/extension.js",
"scripts": {
"compile": "tsc -p ./",
@ -41,9 +45,6 @@
}
}
},
"activationEvents": [
"onStartupFinished"
],
"devDependencies": {
"@types/mocha": "^10.0.6",
"@types/node": "20.x",

View File

@ -40,7 +40,7 @@ export function activate(context: vscode.ExtensionContext) {
const filePath = editor.document.fileName;
console.log('Opened file:', filePath);
vscode.window.showInformationMessage(`Opened file: ${filePath}`);
// vscode.window.showInformationMessage(`Opened file: ${filePath}`);
await makeHttpRequest({ event: 'open', project: extractProjectName(filePath) });
}
});
@ -50,7 +50,7 @@ export function activate(context: vscode.ExtensionContext) {
const filePath = document.fileName;
console.log('Saved file:', filePath);
vscode.window.showInformationMessage(`Saved file: ${filePath}`);
// vscode.window.showInformationMessage(`Saved file: ${filePath}`);
await makeHttpRequest({ event: 'save', project: extractProjectName(filePath) });
});
@ -70,7 +70,7 @@ export function deactivate() { }
*/
function extractProjectName(path: string) {
const match = path.match(/\/root\/(docker|projects)\/([^/]+)/);
return match?.[1];
return match?.[2];
}
/*
@ -83,7 +83,7 @@ async function makeHttpRequest(json: Object) {
return;
}
vscode.window.showInformationMessage('Calling URL: ' + url);
// vscode.window.showInformationMessage('Calling URL: ' + url);
const rawResponse = await fetch(url, {
method: 'POST',
headers: {
@ -95,9 +95,9 @@ async function makeHttpRequest(json: Object) {
const content = await rawResponse.json();
console.log(content);
vscode.window.showInformationMessage('HTTP request successful.');
// vscode.window.showInformationMessage('HTTP request successful.');
} catch (error:any) {
console.error('Error making HTTP request:', error);
vscode.window.showErrorMessage('Error making HTTP request: ' + error.message);
// vscode.window.showErrorMessage('Error making HTTP request: ' + error.message);
}
}