From 4c52d1c7aeead063c4a1f735076f18a2f5851979 Mon Sep 17 00:00:00 2001 From: mainulyaad Date: Thu, 14 Mar 2024 07:01:01 -0400 Subject: [PATCH] when clicked on a code snippet in client, approximately the correct line of code is highlighted in vscode --- src/Constants.ts | 1 + src/utilites.ts | 11 ++++++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/Constants.ts b/src/Constants.ts index faa61cc..93826d1 100644 --- a/src/Constants.ts +++ b/src/Constants.ts @@ -3,6 +3,7 @@ export const Constants = { RULE_TABLE_JSON: "ruleTable.json", TEMP_XML_FILE: "tempResultXmlFile.xml", TEMP_JAVA_FILE: "tempExprFile.java", + TEMP_JAVA_FILE_TESTING:"temptestfile.java", XML_HEADER: "", LEARNING_DR_DIRECTORY:"/LearningDR", SRCML_PATH_WINDOWS: "C:\\Program Files\\srcML 0.9.5\\bin\\srcml", diff --git a/src/utilites.ts b/src/utilites.ts index 0924a5d..5be1c09 100644 --- a/src/utilites.ts +++ b/src/utilites.ts @@ -38,23 +38,24 @@ export function convertToXML(inputFilePath: string): Promise { } export function findLineNumber(xmlFilePath: string): Promise { + console.log("XMLFILEPATH: ",xmlFilePath); const platform = os.platform(); console.log(`The system is running on: ${platform}`); return new Promise((resolve, reject) => { // Construct the command - const command = ""; + let command = ""; if (platform === 'win32') { - const command = `"${Constants.SRCML_PATH_WINDOWS}" --unit 1 "${xmlFilePath}"`; + command = `"${Constants.SRCML_PATH_WINDOWS}" --unit 1 "${xmlFilePath}"`; console.log('This is a Windows system.'); } else if (platform === 'darwin') { - const command = `"${Constants.SRCML_PATH_MAC}" --unit 1 "${xmlFilePath}"`; + command = `"${Constants.SRCML_PATH_MAC}" --unit 1 "${xmlFilePath}"`; console.log('This is a macOS system.'); } else if (platform === 'linux') { - const command = `"${Constants.SRCML_PATH_LINUX}" --unit 1 "${xmlFilePath}"`; + command = `"${Constants.SRCML_PATH_LINUX}" --unit 1 "${xmlFilePath}"`; console.log('This is a Linux system.'); } else { console.log('Unknown or unsupported operating system.'); @@ -128,7 +129,7 @@ function traverseDirectory(currentPath: string, parentNode: DirectoryJson) { if (!isDirectory) { // Include fileType for files - if (shouldIgnoreFileForProjectHierarchy(fullPath)) return; + if (shouldIgnoreFileForProjectHierarchy(fullPath)){ return;}; childNode.properties.fileType = path.extname(dirent.name).substring(1); }