Skip to content

Commit a6f1cbc

Browse files
JeremyYaorthomas320
authored andcommitted
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
1 parent 82db1ad commit a6f1cbc

7 files changed

Lines changed: 36 additions & 37 deletions

File tree

package.json

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,6 @@
111111
"onCommand:extension.dfdl-debug.getSchemaName",
112112
"onCommand:extension.dfdl-debug.getDataName",
113113
"onCommand:extension.dfdl-debug.getTDMLName",
114-
"onCommand:extension.dfdl-debug.getTDMLPath",
115114
"onCommand:extension.dfdl-debug.getValidatedTDMLPath",
116115
"onCommand:extension.dfdl-debug.getValidatedTDMLCopyPath"
117116
],
@@ -576,7 +575,7 @@
576575
},
577576
"path": {
578577
"type": "string",
579-
"default": "${command:AskForTDMLPath}",
578+
"default": "${command:AskForValidatedTDMLPath}",
580579
"description": "TDML Case Path"
581580
}
582581
},
@@ -788,7 +787,8 @@
788787
"path": "^\"\\${workspaceFolder}/target/infoset.xml\""
789788
},
790789
"tdmlConfig": {
791-
"action": "generate"
790+
"action": "generate",
791+
"name": "Default Test Case"
792792
},
793793
"debugServer": 4711,
794794
"openDataEditor": false,
@@ -816,7 +816,6 @@
816816
"variables": {
817817
"AskForSchemaName": "extension.dfdl-debug.getSchemaName",
818818
"AskForDataName": "extension.dfdl-debug.getDataName",
819-
"AskForTDMLPath": "extension.dfdl-debug.getTDMLPath",
820819
"AskForValidatedTDMLPath": "extension.dfdl-debug.getValidatedTDMLPath",
821820
"AskForValidatedTDMLCopyPath": "extension.dfdl-debug.getValidatedTDMLCopyPath"
822821
}

src/adapter/activateDaffodilDebug.ts

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -440,22 +440,6 @@ export function activateDaffodilDebug(
440440
)
441441
)
442442

443-
context.subscriptions.push(
444-
vscode.commands.registerCommand(
445-
'extension.dfdl-debug.getTDMLPath',
446-
async (_) => {
447-
return await vscode.window
448-
.showInputBox({
449-
prompt: 'TDML File: ',
450-
value: '${workspaceFolder}/infoset.tdml',
451-
})
452-
.then((value) => {
453-
return value
454-
})
455-
}
456-
)
457-
)
458-
459443
// register a configuration provider for 'dfdl' debug type
460444
const provider = new DaffodilConfigurationProvider(context)
461445
context.subscriptions.push(

src/daffodilDebugger/debugger.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,18 @@ async function getTDMLConfig(
5858
config.data = ''
5959
config.schema.path = ''
6060

61-
config.tdmlConfig.path =
62-
config.tdmlConfig.path ||
63-
(await vscode.commands.executeCommand(
61+
if (
62+
config.tdmlConfig.path === '${command:AskForValidatedTDMLPath}' ||
63+
!config.tdmlConfig.path
64+
) {
65+
config.tdmlConfig.path = await vscode.commands.executeCommand(
6466
'extension.dfdl-debug.getValidatedTDMLPath'
65-
))
67+
)
68+
}
6669

67-
if (!config.tdmlConfig.path) return false
70+
if (!config.tdmlConfig.path) {
71+
return false
72+
}
6873

6974
config.tdmlConfig.name =
7075
config.tdmlConfig.name ||

src/launchWizard/launchWizard.ts

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -495,8 +495,16 @@ class LaunchWizard {
495495
}
496496
})
497497

498-
let tdmlActionSelect = 'none'
499-
let tdmlActions = ['none', 'generate', 'execute']
498+
const TDML_EXECUTE_ACTION = 'execute'
499+
const TDML_NONE_ACTION = 'none'
500+
const TDML_GENERATE_ACTION = 'generate'
501+
502+
let tdmlActionSelect = TDML_NONE_ACTION
503+
let tdmlActions = [
504+
TDML_NONE_ACTION,
505+
TDML_GENERATE_ACTION,
506+
TDML_EXECUTE_ACTION,
507+
]
500508
let tdmlAction =
501509
'tdmlConfig' in defaultValues ? defaultValues.tdmlConfig['action'] : null
502510
let tdmlName =
@@ -510,11 +518,11 @@ class LaunchWizard {
510518

511519
// tdml items need 0 height and width when hidden so there is no large empty space
512520
let tdmlNameDesVisOrHiddenStyle =
513-
tdmlAction !== null && tdmlAction !== 'none' // Hide TDML name and desc fields if tdmlAction is none
521+
tdmlAction !== null && tdmlAction !== TDML_NONE_ACTION // Hide TDML name and desc fields if tdmlAction is none
514522
? 'margin-top: 10px; visibility: visible;'
515523
: 'width: 0px; height: 0px; visibility: hidden'
516524
let tdmlPathVisOrHiddenStyle =
517-
tdmlAction === 'generate'
525+
tdmlAction === TDML_EXECUTE_ACTION
518526
? 'margin-top: 10px; visibility: visible;'
519527
: 'width: 0px; height: 0px; visibility: hidden'
520528

@@ -729,7 +737,7 @@ class LaunchWizard {
729737
730738
<div id="tdmlActionDiv" class="setting-div">
731739
<p>TDML Action:</p>
732-
<p class="setting-description">TDML Action (none | generate | execute)</p>
740+
<p class="setting-description">TDML Action (${TDML_NONE_ACTION} | ${TDML_GENERATE_ACTION} | ${TDML_EXECUTE_ACTION})</p>
733741
<select onChange="updateTDMLAction()" class="file-input" style="width: 200px;" id="tdmlAction">
734742
${tdmlActionSelect}
735743
</select>

src/launchWizard/script.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -226,11 +226,16 @@ function updateTDMLAction() {
226226
'width: 0px; height: 0px; visibility: hidden;'
227227
}
228228

229-
if (tdmlSelectedValue === 'generate') {
229+
if (tdmlSelectedValue === 'execute') {
230230
document.getElementById('tdmlPathLabel').style =
231231
'margin-top: 10px; visibility: visible;'
232232
document.getElementById('tdmlPath').style =
233233
'margin-top: 10px; visibility: visible;'
234+
235+
// Catch case when we switch from another TDML action to execute and it shows undefined b/c path is not in tdmlConfig object
236+
if (document.getElementById('tdmlPath').value === 'undefined') {
237+
document.getElementById('tdmlPath').value = ''
238+
}
234239
} else {
235240
document.getElementById('tdmlPathLabel').style =
236241
'width: 0px; height: 0px; visibility: hidden;'
@@ -314,9 +319,9 @@ function save() {
314319
switch (configValues.tdmlAction) {
315320
case 'none':
316321
break
317-
case 'generate':
318-
obj.configurations[0].tdmlConfig.path = configValues.tdmlPath
319322
case 'execute':
323+
obj.configurations[0].tdmlConfig.path = configValues.tdmlPath
324+
case 'generate':
320325
obj.configurations[0].tdmlConfig.name = configValues.tdmlName
321326
break
322327
default:

src/tests/suite/utils.test.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
import * as assert from 'assert'
1919
import * as utils from '../../utils'
2020
import { VSCodeLaunchConfigArgs } from '../../classes/vscode-launch'
21-
import { getTmpTDMLFilePath } from 'tdmlEditor/utilities/tdmlXmlUtils'
2221

2322
suite('Utils Test Suite', () => {
2423
var name = 'Default Config'
@@ -44,7 +43,7 @@ suite('Utils Test Suite', () => {
4443
tdmlConfig: {
4544
action: 'generate',
4645
name: 'Default Test Case',
47-
path: getTmpTDMLFilePath(),
46+
path: '${command:AskForValidatedTDMLPath}',
4847
},
4948
stopOnEntry: true,
5049
useExistingServer: false,

src/utils.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ import * as child_process from 'child_process'
2222
import path from 'path'
2323
import { VSCodeLaunchConfigArgs } from './classes/vscode-launch'
2424
import { InfosetOutput } from './daffodilDebugger'
25-
import { getTmpTDMLFilePath } from './tdmlEditor/utilities/tdmlXmlUtils'
2625
import { XMLParser } from 'fast-xml-parser'
2726

2827
let currentConfig: vscode.DebugConfiguration
@@ -139,7 +138,7 @@ export function getConfig(jsonArgs: object): vscode.DebugConfiguration {
139138
...{
140139
action: 'generate',
141140
name: 'Default Test Case',
142-
path: getTmpTDMLFilePath(),
141+
path: '${command:AskForValidatedTDMLPath}',
143142
},
144143
...((defaultConf.get('tdmlConfig') as object) || {}),
145144
},

0 commit comments

Comments
 (0)