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]; +}