This is an automated email from the ASF dual-hosted git repository.
rthomas320 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 a6f1cbc Switch prompts for path from TDML generate to TDML execute in
launch config.
a6f1cbc is described below
commit a6f1cbcb7c7fbdb50f05aa8b3ac141192c056ce6
Author: Jeremy Yao <[email protected]>
AuthorDate: Tue Sep 16 17:14:40 2025 -0400
Switch prompts for path from TDML generate to TDML execute in launch config.
Add Default Test Case name when adding config with the blue Add
Configuration... button
Closes #1347
---
package.json | 7 +++----
src/adapter/activateDaffodilDebug.ts | 16 ----------------
src/daffodilDebugger/debugger.ts | 15 ++++++++++-----
src/launchWizard/launchWizard.ts | 18 +++++++++++++-----
src/launchWizard/script.js | 11 ++++++++---
src/tests/suite/utils.test.ts | 3 +--
src/utils.ts | 3 +--
7 files changed, 36 insertions(+), 37 deletions(-)
diff --git a/package.json b/package.json
index fb13b51..7655fc0 100644
--- a/package.json
+++ b/package.json
@@ -111,7 +111,6 @@
"onCommand:extension.dfdl-debug.getSchemaName",
"onCommand:extension.dfdl-debug.getDataName",
"onCommand:extension.dfdl-debug.getTDMLName",
- "onCommand:extension.dfdl-debug.getTDMLPath",
"onCommand:extension.dfdl-debug.getValidatedTDMLPath",
"onCommand:extension.dfdl-debug.getValidatedTDMLCopyPath"
],
@@ -576,7 +575,7 @@
},
"path": {
"type": "string",
- "default": "${command:AskForTDMLPath}",
+ "default": "${command:AskForValidatedTDMLPath}",
"description": "TDML Case Path"
}
},
@@ -788,7 +787,8 @@
"path": "^\"\\${workspaceFolder}/target/infoset.xml\""
},
"tdmlConfig": {
- "action": "generate"
+ "action": "generate",
+ "name": "Default Test Case"
},
"debugServer": 4711,
"openDataEditor": false,
@@ -816,7 +816,6 @@
"variables": {
"AskForSchemaName": "extension.dfdl-debug.getSchemaName",
"AskForDataName": "extension.dfdl-debug.getDataName",
- "AskForTDMLPath": "extension.dfdl-debug.getTDMLPath",
"AskForValidatedTDMLPath":
"extension.dfdl-debug.getValidatedTDMLPath",
"AskForValidatedTDMLCopyPath":
"extension.dfdl-debug.getValidatedTDMLCopyPath"
}
diff --git a/src/adapter/activateDaffodilDebug.ts
b/src/adapter/activateDaffodilDebug.ts
index 4e67a26..c5ce90e 100644
--- a/src/adapter/activateDaffodilDebug.ts
+++ b/src/adapter/activateDaffodilDebug.ts
@@ -440,22 +440,6 @@ export function activateDaffodilDebug(
)
)
- context.subscriptions.push(
- vscode.commands.registerCommand(
- 'extension.dfdl-debug.getTDMLPath',
- async (_) => {
- return await vscode.window
- .showInputBox({
- prompt: 'TDML File: ',
- value: '${workspaceFolder}/infoset.tdml',
- })
- .then((value) => {
- return value
- })
- }
- )
- )
-
// register a configuration provider for 'dfdl' debug type
const provider = new DaffodilConfigurationProvider(context)
context.subscriptions.push(
diff --git a/src/daffodilDebugger/debugger.ts b/src/daffodilDebugger/debugger.ts
index 8e21f95..1171a50 100644
--- a/src/daffodilDebugger/debugger.ts
+++ b/src/daffodilDebugger/debugger.ts
@@ -58,13 +58,18 @@ async function getTDMLConfig(
config.data = ''
config.schema.path = ''
- config.tdmlConfig.path =
- config.tdmlConfig.path ||
- (await vscode.commands.executeCommand(
+ if (
+ config.tdmlConfig.path === '${command:AskForValidatedTDMLPath}' ||
+ !config.tdmlConfig.path
+ ) {
+ config.tdmlConfig.path = await vscode.commands.executeCommand(
'extension.dfdl-debug.getValidatedTDMLPath'
- ))
+ )
+ }
- if (!config.tdmlConfig.path) return false
+ if (!config.tdmlConfig.path) {
+ return false
+ }
config.tdmlConfig.name =
config.tdmlConfig.name ||
diff --git a/src/launchWizard/launchWizard.ts b/src/launchWizard/launchWizard.ts
index 3d6e285..aa87ede 100644
--- a/src/launchWizard/launchWizard.ts
+++ b/src/launchWizard/launchWizard.ts
@@ -495,8 +495,16 @@ class LaunchWizard {
}
})
- let tdmlActionSelect = 'none'
- let tdmlActions = ['none', 'generate', 'execute']
+ const TDML_EXECUTE_ACTION = 'execute'
+ const TDML_NONE_ACTION = 'none'
+ const TDML_GENERATE_ACTION = 'generate'
+
+ let tdmlActionSelect = TDML_NONE_ACTION
+ let tdmlActions = [
+ TDML_NONE_ACTION,
+ TDML_GENERATE_ACTION,
+ TDML_EXECUTE_ACTION,
+ ]
let tdmlAction =
'tdmlConfig' in defaultValues ? defaultValues.tdmlConfig['action'] : null
let tdmlName =
@@ -510,11 +518,11 @@ class LaunchWizard {
// tdml items need 0 height and width when hidden so there is no large
empty space
let tdmlNameDesVisOrHiddenStyle =
- tdmlAction !== null && tdmlAction !== 'none' // Hide TDML name and desc
fields if tdmlAction is none
+ tdmlAction !== null && tdmlAction !== TDML_NONE_ACTION // Hide TDML name
and desc fields if tdmlAction is none
? 'margin-top: 10px; visibility: visible;'
: 'width: 0px; height: 0px; visibility: hidden'
let tdmlPathVisOrHiddenStyle =
- tdmlAction === 'generate'
+ tdmlAction === TDML_EXECUTE_ACTION
? 'margin-top: 10px; visibility: visible;'
: 'width: 0px; height: 0px; visibility: hidden'
@@ -729,7 +737,7 @@ class LaunchWizard {
<div id="tdmlActionDiv" class="setting-div">
<p>TDML Action:</p>
- <p class="setting-description">TDML Action (none | generate |
execute)</p>
+ <p class="setting-description">TDML Action (${TDML_NONE_ACTION} |
${TDML_GENERATE_ACTION} | ${TDML_EXECUTE_ACTION})</p>
<select onChange="updateTDMLAction()" class="file-input" style="width:
200px;" id="tdmlAction">
${tdmlActionSelect}
</select>
diff --git a/src/launchWizard/script.js b/src/launchWizard/script.js
index 7ec75b4..2704fde 100644
--- a/src/launchWizard/script.js
+++ b/src/launchWizard/script.js
@@ -226,11 +226,16 @@ function updateTDMLAction() {
'width: 0px; height: 0px; visibility: hidden;'
}
- if (tdmlSelectedValue === 'generate') {
+ if (tdmlSelectedValue === 'execute') {
document.getElementById('tdmlPathLabel').style =
'margin-top: 10px; visibility: visible;'
document.getElementById('tdmlPath').style =
'margin-top: 10px; visibility: visible;'
+
+ // Catch case when we switch from another TDML action to execute and it
shows undefined b/c path is not in tdmlConfig object
+ if (document.getElementById('tdmlPath').value === 'undefined') {
+ document.getElementById('tdmlPath').value = ''
+ }
} else {
document.getElementById('tdmlPathLabel').style =
'width: 0px; height: 0px; visibility: hidden;'
@@ -314,9 +319,9 @@ function save() {
switch (configValues.tdmlAction) {
case 'none':
break
- case 'generate':
- obj.configurations[0].tdmlConfig.path = configValues.tdmlPath
case 'execute':
+ obj.configurations[0].tdmlConfig.path = configValues.tdmlPath
+ case 'generate':
obj.configurations[0].tdmlConfig.name = configValues.tdmlName
break
default:
diff --git a/src/tests/suite/utils.test.ts b/src/tests/suite/utils.test.ts
index 1e6e45d..291d3c6 100644
--- a/src/tests/suite/utils.test.ts
+++ b/src/tests/suite/utils.test.ts
@@ -18,7 +18,6 @@
import * as assert from 'assert'
import * as utils from '../../utils'
import { VSCodeLaunchConfigArgs } from '../../classes/vscode-launch'
-import { getTmpTDMLFilePath } from 'tdmlEditor/utilities/tdmlXmlUtils'
suite('Utils Test Suite', () => {
var name = 'Default Config'
@@ -44,7 +43,7 @@ suite('Utils Test Suite', () => {
tdmlConfig: {
action: 'generate',
name: 'Default Test Case',
- path: getTmpTDMLFilePath(),
+ path: '${command:AskForValidatedTDMLPath}',
},
stopOnEntry: true,
useExistingServer: false,
diff --git a/src/utils.ts b/src/utils.ts
index 5242fb3..735d58a 100644
--- a/src/utils.ts
+++ b/src/utils.ts
@@ -22,7 +22,6 @@ import * as child_process from 'child_process'
import path from 'path'
import { VSCodeLaunchConfigArgs } from './classes/vscode-launch'
import { InfosetOutput } from './daffodilDebugger'
-import { getTmpTDMLFilePath } from './tdmlEditor/utilities/tdmlXmlUtils'
import { XMLParser } from 'fast-xml-parser'
let currentConfig: vscode.DebugConfiguration
@@ -139,7 +138,7 @@ export function getConfig(jsonArgs: object):
vscode.DebugConfiguration {
...{
action: 'generate',
name: 'Default Test Case',
- path: getTmpTDMLFilePath(),
+ path: '${command:AskForValidatedTDMLPath}',
},
...((defaultConf.get('tdmlConfig') as object) || {}),
},