From 0dc1bb076766c9b6d6aa43ede9c94d2df7330eb1 Mon Sep 17 00:00:00 2001 From: Raphael Piccolo Date: Thu, 4 Apr 2024 10:04:05 +0200 Subject: [PATCH] -up --- src/extension.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/extension.ts b/src/extension.ts index d4b65bb..e22bc59 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -30,7 +30,7 @@ export function activate(context: vscode.ExtensionContext) { vscode.window.showWarningMessage('URL is not set. Please set the URL first.'); return; } - await makeHttpRequest({}); + await makeHttpRequest({ event: 'ping'}); }); context.subscriptions.push(disposable3); @@ -68,7 +68,7 @@ export function activate(context: vscode.ExtensionContext) { console.log('Opened file:', filePath); vscode.window.showInformationMessage(`Opened file: ${filePath}`); - await makeHttpRequest({ opened: filePath }); + await makeHttpRequest({ event: 'open', project: extractProjectName(filePath) }); } }); @@ -78,7 +78,7 @@ export function activate(context: vscode.ExtensionContext) { console.log('Saved file:', filePath); vscode.window.showInformationMessage(`Saved file: ${filePath}`); - await makeHttpRequest({ saved: filePath }); + await makeHttpRequest({ event: 'save', project: extractProjectName(filePath) }); }); // detecte un focus / blur de la fenetre vscode @@ -89,3 +89,8 @@ export function activate(context: vscode.ExtensionContext) { } export function deactivate() { } + +function extractProjectName(path) { + const match = path.match(/\/root\/(docker|projects)\/([^/]+)/); + return match?.[1]; +}