You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@daffodil.apache.org by ar...@apache.org on 2022/08/05 17:38:31 UTC

[daffodil-vscode] 27/28: Get the extension closer to passing correct TDML parameters to backend

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

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

commit 52eab357b628037bc513912a5f5c2dddef317a46
Author: Michael Hoke <mi...@nteligen.com>
AuthorDate: Mon Aug 1 17:54:56 2022 -0400

    Get the extension closer to passing correct TDML parameters to backend
---
 package.json                         | 16 +++++++++-------
 src/adapter/activateDaffodilDebug.ts |  7 +++++--
 src/daffodilDebugger.ts              | 25 +++++++++++++------------
 src/utils.ts                         |  4 ++--
 4 files changed, 29 insertions(+), 23 deletions(-)

diff --git a/package.json b/package.json
index cf0ada6..84a042c 100644
--- a/package.json
+++ b/package.json
@@ -322,8 +322,8 @@
                 "description": "Configuration for TDML Actions",
                 "default": {
                   "action": "none",
-                  "name": "Default Test Case",
-                  "description": "Generated by DFDL VSCode Extension",
+                  "name": "${command:AskForTDMLName}",
+                  "description": "${command:AskForTDMLDescription}",
                   "path": "${workspaceFolder}/infoset.tdml"
                 }
               },
@@ -384,8 +384,8 @@
             },
             "tdmlConfig": {
               "action": "none",
-              "name": "Default Test Case",
-              "description": "Generated by DFDL VSCode Extension",
+              "name": "${command:AskForTDMLName}",
+              "description": "${command:AskForTDMLDescription}",
               "path": "${workspaceFolder}/infoset.tdml"
             },
             "debugServer": 4711,
@@ -412,8 +412,8 @@
               },
               "tdmlConfig": {
                 "action": "none",
-                "name": "Default Test Case",
-                "description": "Generated by DFDL VSCode Extension",
+                "name": "^\"\\${command:AskForTDMLName}\"",
+                "description": "^\"\\${command:AskForTDMLDescription}\"",
                 "path": "${workspaceFolder}/infoset.tdml"
               },
               "debugServer": 4711,
@@ -426,7 +426,9 @@
         ],
         "variables": {
           "AskForProgramName": "extension.dfdl-debug.getProgramName",
-          "AskForDataName": "extension.dfdl-debug.getDataName"
+          "AskForDataName": "extension.dfdl-debug.getDataName",
+          "AskForTDMLName": "extension.dfdl-debug.getTDMLName",
+          "AskForTDMLDescription": "extension.dfdl-debug.getTDMLDescription"
         }
       }
     ],
diff --git a/src/adapter/activateDaffodilDebug.ts b/src/adapter/activateDaffodilDebug.ts
index 3fd782b..d76a6fa 100644
--- a/src/adapter/activateDaffodilDebug.ts
+++ b/src/adapter/activateDaffodilDebug.ts
@@ -46,6 +46,9 @@ function createDebugRunFileConfigs(
 
     if (tdmlAction) {
       tdmlConfig.action = tdmlAction
+      tdmlConfig.name = ''
+      tdmlConfig.description = ''
+      tdmlConfig.path = ''
     }
 
     vscode.debug.startDebugging(
@@ -185,7 +188,7 @@ export function activateDaffodilDebug(
 
   context.subscriptions.push(
     vscode.commands.registerCommand(
-      'extension.dfdl-debug.getTMDLName',
+      'extension.dfdl-debug.getTDMLName',
       async (_) => {
         return await vscode.window
           .showInputBox({
@@ -201,7 +204,7 @@ export function activateDaffodilDebug(
 
   context.subscriptions.push(
     vscode.commands.registerCommand(
-      'extension.dfdl-debug.getTMDLDescription',
+      'extension.dfdl-debug.getTDMLDescription',
       async (_) => {
         return await vscode.window
           .showInputBox({
diff --git a/src/daffodilDebugger.ts b/src/daffodilDebugger.ts
index 7ff0dd4..05a10ec 100644
--- a/src/daffodilDebugger.ts
+++ b/src/daffodilDebugger.ts
@@ -185,23 +185,24 @@ export async function getDebugger(
         return stopDebugging()
       }
 
-      if (config.tdmlConfig.action !== 'none') {
+      if (config.tdmlAction !== 'none') {
         if (
-          typeof config.tdmlConfig.name !== 'undefined' &&
-          config.tdmlConfig.name === ''
-        ) {
-          config.tdmlConfig.name = await vscode.commands.executeCommand(
+          config.tdmlName === undefined ||
+          config.tdmlName.includes('${command:AskForTDMLName}')
+        )
+          config.tdmlName = await vscode.commands.executeCommand(
             'extension.dfdl-debug.getTDMLName'
           )
-        }
-
-        if (config.tdmlConfig.description === '') {
-          config.tdmlConfig.description = await vscode.commands.executeCommand(
-            'extension.dfdl-debug.getTDMLDescription'
-          )
-        }
       }
 
+      if (
+        config.tdmlDescription === undefined ||
+        config.tdmlDescription.includes('${command:AskForTDMLDescription}')
+      )
+        config.tdmlDescription = await vscode.commands.executeCommand(
+          'extension.dfdl-debug.getTDMLDescription'
+        )
+
       let workspaceFolder = vscode.workspace.workspaceFolders
         ? vscode.workspace.workspaceFolders[0].uri.fsPath
         : vscode.Uri.parse('').fsPath
diff --git a/src/utils.ts b/src/utils.ts
index dba985f..360a2a1 100644
--- a/src/utils.ts
+++ b/src/utils.ts
@@ -114,10 +114,10 @@ export function getConfig(
       ? tdmlConfig
       : {
           action: defaultConf.get('tdmlAction', 'none'),
-          name: defaultConf.get('tdmlName', 'Default Test Case'),
+          name: defaultConf.get('tdmlName', '${command:AskforTDMLName}'),
           description: defaultConf.get(
             'tdmlDescription',
-            'Generated by DFDL VSCode Extension'
+            '${command:AskForTDMLDescription}'
           ),
           path: defaultConf.get('tdmlPath', '${workspaceFolder}/infoset.tdml'),
         },