From e8c04cdbbe8fe7346e26159d4a70f70aea2d5be2 Mon Sep 17 00:00:00 2001 From: Alan Hamlett Date: Fri, 22 Nov 2024 11:05:59 +0100 Subject: [PATCH] Support Windsurf editor and any future unknown editors --- src/wakatime.ts | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/wakatime.ts b/src/wakatime.ts index 3de8744..dadad27 100644 --- a/src/wakatime.ts +++ b/src/wakatime.ts @@ -26,10 +26,11 @@ export class WakaTime { 'Arduino IDE': 'arduino', 'Azure Data Studio': 'azdata', Cursor: 'cursor', - 'SQL Operations Studio': 'sqlops', - 'Visual Studio Code': 'vscode', Onivim: 'onivim', 'Onivim 2': 'onivim', + 'SQL Operations Studio': 'sqlops', + 'Visual Studio Code': 'vscode', + Windsurf: 'windsurf', }; private agentName: string; private extension: any; @@ -84,7 +85,14 @@ export class WakaTime { let extension = vscode.extensions.getExtension('WakaTime.vscode-wakatime'); this.extension = (extension != undefined && extension.packageJSON) || { version: '0.0.0' }; - this.agentName = this.appNames[vscode.env.appName] || 'vscode'; + + if (this.appNames[vscode.env.appName]) { + this.agentName = this.appNames[vscode.env.appName]; + } else if (vscode.env.appName.toLowerCase().includes('visual')) { + this.agentName = 'vscode'; + } else { + this.agentName = vscode.env.appName.replace(/\s/g, '').toLowerCase(); + } this.options.getSetting('settings', 'disabled', false, (disabled: Setting) => { this.disabled = disabled.value === 'true';