This is an automated email from the ASF dual-hosted git repository.

shanedell pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/daffodil-vscode.git


The following commit(s) were added to refs/heads/main by this push:
     new 874968f  Fix error handling for TDML inputs
874968f is described below

commit 874968f944a2e059edcf951a79401b43ab1ef0d9
Author: Michael Hoke <[email protected]>
AuthorDate: Tue Aug 12 12:06:08 2025 -0400

    Fix error handling for TDML inputs
---
 src/adapter/activateDaffodilDebug.ts | 25 +++++++++++-----------
 src/daffodilDebugger/debugger.ts     | 40 +++++++++++++++---------------------
 2 files changed, 29 insertions(+), 36 deletions(-)

diff --git a/src/adapter/activateDaffodilDebug.ts 
b/src/adapter/activateDaffodilDebug.ts
index 062a371..876b687 100644
--- a/src/adapter/activateDaffodilDebug.ts
+++ b/src/adapter/activateDaffodilDebug.ts
@@ -175,17 +175,6 @@ async function createDebugRunFileConfigs(
 
         if (tdmlAction === 'execute') {
           tdmlConfig.path = targetResource.fsPath
-
-          tdmlConfig.name =
-            tdmlConfig.name ||
-            (await vscode.commands.executeCommand(
-              'extension.dfdl-debug.getTDMLName',
-              tdmlConfig.path
-            ))
-
-          if (!tdmlConfig.name) {
-            return
-          }
         }
       }
 
@@ -380,11 +369,16 @@ export function activateDaffodilDebug(
       'extension.dfdl-debug.getValidatedTDMLPath',
       async (fileRequested = null) => {
         // Open native file explorer to allow user to select data file from 
anywhere on their machine
-        return await getFile(
+        const retVal = await getFile(
           fileRequested,
           'Select TDML File',
           'Select TDML File'
         )
+
+        if (!retVal)
+          vscode.window.showInformationMessage('Invalid TDML Path selected')
+
+        return retVal
       }
     )
   )
@@ -424,9 +418,14 @@ export function activateDaffodilDebug(
         }
 
         // Await showQuickPick directly and return the result
-        return await vscode.window.showQuickPick(test_case_names, {
+        const retVal = await vscode.window.showQuickPick(test_case_names, {
           placeHolder: 'Test Case Name',
         })
+
+        if (!retVal)
+          vscode.window.showInformationMessage('Invalid TDML Name selected')
+
+        return retVal
       }
     )
   )
diff --git a/src/daffodilDebugger/debugger.ts b/src/daffodilDebugger/debugger.ts
index 7fd9d39..81e4a9b 100644
--- a/src/daffodilDebugger/debugger.ts
+++ b/src/daffodilDebugger/debugger.ts
@@ -53,38 +53,32 @@ async function getTDMLConfig(
   // If we are doing a TDML execute, these fields will be replaced,
   //   so we don't need to prompt for them now.
   if (config?.tdmlConfig?.action === 'execute') {
-    // Erase the value of `data` so that we aren't prompted for it later
-    // Might need to add `schema` here if we move the `Execute TDML` command
-    //   away from the detected dfdl language in VSCode.
+    // Erase the value of `data` and 'schema.path' so that we aren't prompted 
for it later
     config.data = ''
     config.schema.path = ''
 
-    if (config?.tdmlConfig?.path === undefined)
-      config.tdmlConfig.path = await vscode.commands.executeCommand(
+    config.tdmlConfig.path =
+      config.tdmlConfig.path ||
+      (await vscode.commands.executeCommand(
         'extension.dfdl-debug.getValidatedTDMLPath'
-      )
+      ))
+
+    if (!config.tdmlConfig.path) return false
 
-    if (config?.tdmlConfig?.name === undefined)
-      config.tdmlConfig.name = await vscode.commands.executeCommand(
+    config.tdmlConfig.name =
+      config.tdmlConfig.name ||
+      (await vscode.commands.executeCommand(
         'extension.dfdl-debug.getTDMLName',
-        config?.tdmlConfig?.path
-      )
+        config.tdmlConfig.path
+      ))
+
+    if (!config.tdmlConfig.name) return false
   }
 
   if (config?.tdmlConfig?.action === 'generate') {
-    if (
-      config?.tdmlConfig?.name === undefined ||
-      config?.tdmlConfig?.name === 'undefined' ||
-      config?.tdmlConfig?.name === ''
-    )
-      config.tdmlConfig.name = getDefaultTDMLTestCaseName()
-
-    if (
-      config?.tdmlConfig?.path === undefined ||
-      config?.tdmlConfig?.path === 'undefined' ||
-      config?.tdmlConfig?.path === ''
-    )
-      config.tdmlConfig.path = getTmpTDMLFilePath()
+    config.tdmlConfig.name =
+      config.tdmlConfig.name || getDefaultTDMLTestCaseName()
+    config.tdmlConfig.path = config.tdmlConfig.path || getTmpTDMLFilePath()
   }
 
   if (config?.tdmlConfig?.action !== 'execute' && config.data === '') {

Reply via email to