JeremyYao commented on issue #1540:
URL: 
https://github.com/apache/daffodil-vscode/issues/1540#issuecomment-3563346446

   @hdalsania, I'm taking ownership of `Execute functionality is completely 
broken, it does not provide any dropdown to ask for TDML test case name. It 
directly starts executing "Default Test Case" if it exists in TDML file, 
otherwise it throws error. This functionality was implemented in Issue 
https://github.com/apache/daffodil-vscode/issues/1257` as mentioned in our 
conversation. 
   
   @hdalsania, additionally, from my investigation so far, in src/utils.ts,
   
   ```typescript
   /**
    * Retrieves an array of test case items from a TDML (Test Data Markup 
Language) file.
    *
    * @param path - The file path to the TDML file.
    * @returns An array of test case names
    */
   export function getTDMLTestCaseItems(path: string): string[] {
     if (!fs.existsSync(path)) {
       return [] // TDML file not found
     }
   
     // Needed objects for parsing
     const parser = new XMLParser({
       ignoreAttributes: false,
       removeNSPrefix: true,
     })
     const fileData = fs.readFileSync(path)
   
     // representaiton of TDML XML file as JS object
     const xml_obj = parser.parse(fileData)
   
     // Read through TDML test cases and populate each TDML test case item if 
XML file is valid enough
     // parserTestCaseObjs can be either an array of objects, a single object, 
or undefined if no parserTestCase element was found
     // Convert that into an array and return a list containing the names of 
each parserTestCase element
     const parserTestCaseObjs = xml_obj['testSuite']?.['parserTestCase']
     const testCaseArr = Array.isArray(parserTestCaseObjs)
       ? parserTestCaseObjs
       : parserTestCaseObjs
         ? [parserTestCaseObjs]
         : []
     return testCaseArr.map((item) => item['@_name'])
   }
   ```
   
   doesn't get called when I set a breakpoint in there nor does 
   
   ```typescript
   
     context.subscriptions.push(
       vscode.commands.registerCommand(
         'extension.dfdl-debug.getTDMLName',
         async (tdmlConfigPath) => {
           // get test case name options for dropdown
           const test_case_names: string[] = 
getTDMLTestCaseItems(tdmlConfigPath)
   
           if (test_case_names.length == 0) {
             vscode.window.showInformationMessage(
               'No test cases found in TDML file.'
             )
             return
           }
   
           // Await showQuickPick directly and return the result
           const retVal = await vscode.window.showQuickPick(test_case_names, {
             placeHolder: 'Test Case Name',
           })
   
           if (!retVal)
             vscode.window.showInformationMessage('Invalid TDML Name selected')
   
           return retVal
         }
       )
     )
   ```
   
   in activateDaffodilDebug.ts when I set a breakpoint on `const 
test_case_names: string[] = getTDMLTestCaseItems(tdmlConfigPath)`


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to