shanedell commented on code in PR #1521:
URL: https://github.com/apache/daffodil-vscode/pull/1521#discussion_r2500923623


##########
src/adapter/activateDaffodilDebug.ts:
##########
@@ -188,13 +192,11 @@ async function createDebugRunFileConfigs(
         request: 'launch',
         type: 'dfdl',
         schema: {
-          path: tdmlConfig?.action === 'execute' ? '' : normalizedResource,
+          ...(newSchema && { path: newSchema }),

Review Comment:
   You don't need to do this, it can be simplified to:
   
   ```suggestion
             path: newSchema,
   ```



##########
src/adapter/activateDaffodilDebug.ts:
##########
@@ -174,12 +174,16 @@ async function createDebugRunFileConfigs(
       })
     } else {
       var tdmlConfig: TDMLConfig | undefined = undefined
+      var newData: string | undefined = undefined
+      var newSchema: string | undefined = undefined

Review Comment:
   The default should not be undefined. They should be undefined if the 
`tdmlAction === 'execute'`
   
   ```suggestion
         var newSchema: string | undefined = normalizedResource
         var newData: string | undefined = '${command:AskForDataName}'
   ```



##########
src/adapter/activateDaffodilDebug.ts:
##########
@@ -188,13 +192,11 @@ async function createDebugRunFileConfigs(
         request: 'launch',
         type: 'dfdl',
         schema: {
-          path: tdmlConfig?.action === 'execute' ? '' : normalizedResource,
+          ...(newSchema && { path: newSchema }),
           rootName: null,
           rootNamespace: null,
         },
-        data:
-          tdmlConfig?.action === 'execute' ? '' : '${command:AskForDataName}',
-        debugServer: false,
+        ...(newData && { data: newData }),

Review Comment:
   You don't need to do this, it can be simplified to:
   
   ```suggestion
           data: newData,
   ```



##########
src/adapter/activateDaffodilDebug.ts:
##########
@@ -174,12 +174,16 @@ async function createDebugRunFileConfigs(
       })
     } else {
       var tdmlConfig: TDMLConfig | undefined = undefined
+      var newData: string | undefined = undefined
+      var newSchema: string | undefined = undefined
 
       if (tdmlAction) {
         tdmlConfig = { action: tdmlAction }
 
         if (tdmlAction === 'execute') {
           tdmlConfig.path = normalizedResource
+          newData = ''
+          newSchema = ''

Review Comment:
   Instead of setting to an empty string, since they can be undefined you can 
do the below instead
   
   ```suggestion
             newSchema = undefined
             newData = undefined
   ```



-- 
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