From fd26c1dfd05d713c0358c7eeac5f1a9ee2baacfe Mon Sep 17 00:00:00 2001 From: Aditya-eddy Date: Wed, 9 Oct 2024 00:59:28 +0530 Subject: [PATCH] fix:correcting functionNames for javascript and typeScript Signed-off-by: Aditya-eddy --- src/extension.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/extension.ts b/src/extension.ts index 46121fc..1d74627 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -145,8 +145,8 @@ class KeployCodeLensProvider implements vscode.CodeLensProvider { ) { const line = document.positionAt(node.startIndex).line; const range = new vscode.Range(line, 0, line, 0); - console.log('🐰 Found function:', node.firstChild?.text); - const functionName = node.firstChild?.text || ''; + console.log('🐰 Found function:', node.childForFieldName('name')?.text); + const functionName = node.childForFieldName('name')?.text || ''; codeLenses.push(new vscode.CodeLens(range, { title: '🐰 Generate unit tests', command: 'keploy.utg', @@ -177,7 +177,7 @@ class KeployCodeLensProvider implements vscode.CodeLensProvider { command: 'keploy.showSidebar', arguments: [document.uri.fsPath,functionName,fileExtension] })); - console.log('🐰 Found arrow function:', node.firstChild?.text); + console.log('🐰 Found arrow function:', node?.text); } } } else if (fileName.endsWith('.py') && node.type === 'function_definition') {