Skip to content

Commit

Permalink
when clicked on a code snippet in client, approximately the correct l…
Browse files Browse the repository at this point in the history
…ine of code is highlighted in vscode
  • Loading branch information
yaad96 committed Mar 14, 2024
1 parent 13e8ff3 commit 4c52d1c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
1 change: 1 addition & 0 deletions src/Constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>",
LEARNING_DR_DIRECTORY:"/LearningDR",
SRCML_PATH_WINDOWS: "C:\\Program Files\\srcML 0.9.5\\bin\\srcml",
Expand Down
11 changes: 6 additions & 5 deletions src/utilites.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,23 +38,24 @@ export function convertToXML(inputFilePath: string): Promise<string> {
}

export function findLineNumber(xmlFilePath: string): Promise<string> {
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.');
Expand Down Expand Up @@ -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);
}

Expand Down

0 comments on commit 4c52d1c

Please sign in to comment.