- Make TDMLConfig an optional part of a launch configuration
- Remove 'none' as a valid TDMLConfig action
diff --git a/.vscode/launch.json b/.vscode/launch.json
index 8208a45..00aeea0 100644
--- a/.vscode/launch.json
+++ b/.vscode/launch.json
@@ -28,13 +28,7 @@
"infosetFormat": "xml",
"infosetOutput": {
"type": "file",
- "path": "/infoset.xml"
- },
- "tdmlConfig": {
- "action": "none",
- "name": "${command:AskForTDMLName}",
- "description": "${command:AskForTDMLDescription}",
- "path": "${command:AskForTDMLPath}"
+ "path": "${workspaceFolder}/infoset.xml"
},
"debugServer": 4711,
"openHexView": false,
diff --git a/package.json b/package.json
index d9f35ae..c1cd588 100644
--- a/package.json
+++ b/package.json
@@ -353,7 +353,7 @@
"type": "object",
"description": "Configuration for TDML Actions",
"default": {
- "action": "none",
+ "action": "generate",
"name": "${command:AskForTDMLName}",
"description": "${command:AskForTDMLDescription}",
"path": "${command:AskForTDMLPath}"
@@ -438,12 +438,6 @@
"type": "file",
"path": "${workspaceFolder}/infoset.xml"
},
- "tdmlConfig": {
- "action": "none",
- "name": "${command:AskForTDMLName}",
- "description": "${command:AskForTDMLDescription}",
- "path": "${command:AskForTDMLPath}"
- },
"debugServer": 4711,
"openHexView": false,
"openInfosetView": false,
@@ -474,12 +468,6 @@
"type": "file",
"path": "${workspaceFolder}/infoset.xml"
},
- "tdmlConfig": {
- "action": "none",
- "name": "^\"\\${command:AskForTDMLName}\"",
- "description": "^\"\\${command:AskForTDMLDescription}\"",
- "path": "^\"\\${command:AskForTDMLPath}\""
- },
"debugServer": 4711,
"openHexView": false,
"openInfosetView": false,
@@ -525,12 +513,11 @@
},
"tdmlAction": {
"type": "string",
- "description": "TDML Action to take (generate | append | execute | none)",
+ "description": "TDML Action to take (generate | append | execute)",
"enum": [
"generate",
"append",
- "execute",
- "none"
+ "execute"
],
"default": "none"
},
diff --git a/server/core/src/main/scala/org.apache.daffodil.debugger.dap/Parse.scala b/server/core/src/main/scala/org.apache.daffodil.debugger.dap/Parse.scala
index c22840e..bd74dbc 100644
--- a/server/core/src/main/scala/org.apache.daffodil.debugger.dap/Parse.scala
+++ b/server/core/src/main/scala/org.apache.daffodil.debugger.dap/Parse.scala
@@ -342,19 +342,9 @@
parseVariables(arguments),
parseTunables(arguments)
).parMapN(LaunchArgs.TDMLConfig.Execute.apply)
- case "none" =>
- (
- parseProgram(arguments),
- parseData(arguments),
- parseStopOnEntry(arguments),
- parseInfosetFormat(arguments),
- parseInfosetOutput(arguments),
- parseVariables(arguments),
- parseTunables(arguments)
- ).parMapN(LaunchArgs.Manual.apply)
case invalidType =>
Left(
- s"invalid 'tdmlConfig.action': '$invalidType', must be 'none', 'generate', 'append', or 'execute'"
+ s"invalid 'tdmlConfig.action': '$invalidType', must be 'generate', 'append', or 'execute'"
).toEitherNel
}
}
diff --git a/server/core/src/test/scala/org.apache.daffodil.debugger/ParseSuite.scala b/server/core/src/test/scala/org.apache.daffodil.debugger/ParseSuite.scala
index 2d2a6e6..ea67d0c 100644
--- a/server/core/src/test/scala/org.apache.daffodil.debugger/ParseSuite.scala
+++ b/server/core/src/test/scala/org.apache.daffodil.debugger/ParseSuite.scala
@@ -30,7 +30,7 @@
val infosetFormat = "xml"
var infosetOutputType = "none"
var infosetOutputPath = "testPath/infoset.xml"
- var tdmlAction = "none"
+ var tdmlAction = ""
val tdmlName = "Test TDML Name"
val tdmlDescription = "Test TDML Description"
val tdmlPath = "testPath/test.tdml"
@@ -42,15 +42,18 @@
val openInfosetDiffView = false
val daffodilDebugClasspath = ""
- val testJsonObject = new JsonObject()
- val testTDMLObject = new JsonObject()
+ var testJsonObject = new JsonObject()
+ var testTDMLObject = new JsonObject()
override def beforeEach(context: BeforeEach): Unit = {
program = Paths.get("./server/core/src/test/data/emptySchema.dfdl.xsd").toAbsolutePath().toString()
data = Paths.get("./server/core/src/test/data/emptyData.xml").toAbsolutePath().toString()
infosetOutputType = "none"
infosetOutputPath = "testPath/infoset.xml"
- tdmlAction = "none"
+ tdmlAction = ""
+
+ testJsonObject = new JsonObject()
+ testTDMLObject = new JsonObject()
}
test("Parse Successful") {
@@ -101,6 +104,7 @@
}
test("Parse failed - invalid tdmlConfig - no name") {
+ tdmlAction = "generate"
buildJson()
testTDMLObject.remove("name")
val parseResult = Parse.Debugee.parseTDMLName(testTDMLObject)
@@ -109,6 +113,7 @@
}
test("Parse failed - invalid tdmlConfig - no description") {
+ tdmlAction = "generate"
buildJson()
testTDMLObject.remove("description")
val parseResult = Parse.Debugee.parseTDMLDescription(testTDMLObject)
@@ -117,6 +122,7 @@
}
test("Parse failed - invalid tdmlConfig - no path") {
+ tdmlAction = "generate"
buildJson()
testTDMLObject.remove("path")
val parseResult = Parse.Debugee.parseTDMLPath(testTDMLObject)
@@ -131,9 +137,8 @@
assertEquals(parseResult.isLeft, true)
assertEquals(
parseResult.left.get.head,
- "invalid 'tdmlConfig.action': 'InvalidAction', must be 'none', 'generate', 'append', or 'execute'"
+ "invalid 'tdmlConfig.action': 'InvalidAction', must be 'generate', 'append', or 'execute'"
)
- tdmlAction = "none"
}
test("Parse failed - Invalid Program Path") {
@@ -172,7 +177,10 @@
testJsonObject.addProperty("infosetFormat", infosetFormat)
testJsonObject.add("infosetOutput", infoset)
- testJsonObject.add("tdmlConfig", testTDMLObject)
+
+ if (!tdmlAction.isEmpty()) {
+ testJsonObject.add("tdmlConfig", testTDMLObject)
+ }
testJsonObject.addProperty("stopOnEntry", stopOnEntry)
testJsonObject.addProperty("useExistingServer", useExistingServer)
diff --git a/src/launchWizard/launchWizard.js b/src/launchWizard/launchWizard.js
index 6f204de..015e314 100644
--- a/src/launchWizard/launchWizard.js
+++ b/src/launchWizard/launchWizard.js
@@ -252,20 +252,22 @@
]
? config.infosetOutput['type']
: config.infosetOutputType
- document.getElementById('tdmlAction').value = config.tdmlConfig['action']
- ? config.tdmlConfig['action']
- : config.tdmlAction
- document.getElementById('tdmlName').value = config.tdmlConfig['name']
- ? config.tdmlConfig['name']
- : config.tdmlName
- document.getElementById('tdmlDescription').value = config.tdmlConfig[
- 'description'
- ]
- ? config.tdmlConfig['description']
- : config.tdmlDescription
- document.getElementById('tdmlPath').value = config.tdmlConfig['path']
- ? config.tdmlConfig['path']
- : config.tdmlPath
+ document.getElementById('tdmlAction').value =
+ config['tdmlConfig'] && config.tdmlConfig['action']
+ ? config.tdmlConfig['action']
+ : config.tdmlAction
+ document.getElementById('tdmlName').value =
+ config['tdmlConfig'] && config.tdmlConfig['name']
+ ? config.tdmlConfig['name']
+ : config.tdmlName
+ document.getElementById('tdmlDescription').value =
+ config['tdmlConfig'] && config.tdmlConfig['description']
+ ? config.tdmlConfig['description']
+ : config.tdmlDescription
+ document.getElementById('tdmlPath').value =
+ config['tdmlConfig'] && config.tdmlConfig['path']
+ ? config.tdmlConfig['path']
+ : config.tdmlPath
document.getElementById('openHexView').checked = config.openHexView
document.getElementById('openInfosetDiffView').checked =
config.openInfosetDiffView
diff --git a/src/launchWizard/launchWizard.ts b/src/launchWizard/launchWizard.ts
index 1cfac4e..13d48d9 100644
--- a/src/launchWizard/launchWizard.ts
+++ b/src/launchWizard/launchWizard.ts
@@ -352,15 +352,21 @@
})
let tdmlActionSelect = ''
- let tdmlActions = ['none', 'generate', 'append', 'execute']
- let tdmlAction = defaultValues.tdmlConfig['action']
- let tdmlName = defaultValues.tdmlConfig['name']
- let tdmlDescription = defaultValues.tdmlConfig['description']
- let tdmlPath = defaultValues.tdmlConfig['path']
+ let tdmlActions = ['generate', 'append', 'execute']
+ let tdmlAction =
+ 'tdmlConfig' in defaultValues ? defaultValues.tdmlConfig['action'] : null
+ let tdmlName =
+ 'tdmlConfig' in defaultValues ? defaultValues.tdmlConfig['name'] : null
+ let tdmlDescription =
+ 'tdmlConfig' in defaultValues
+ ? defaultValues.tdmlConfig['description']
+ : null
+ let tdmlPath =
+ 'tdmlConfig' in defaultValues ? defaultValues.tdmlConfig['path'] : null
// tdml items need 0 height and width when hidden so there is no large empty space
let tdmlNameDesVisOrHiddenStyle =
- tdmlAction !== 'none'
+ tdmlAction !== null
? 'margin-top: 10px; visibility: visible;'
: 'width: 0px; height: 0px; visibility: hidden'
let tdmlPathVisOrHiddenStyle =
@@ -494,7 +500,7 @@
<div id="tdmlActionDiv" class="setting-div">
<p>TDML Action:</p>
- <p class="setting-description">TDML Action (none | generate | append | execute)</p>
+ <p class="setting-description">TDML Action (generate | append | execute)</p>
<select onChange="updateTDMLAction()" class="file-input" style="width: 200px;" id="tdmlAction">
${tdmlActionSelect}
</select>
diff --git a/src/tests/suite/daffodilDebugger.test.ts b/src/tests/suite/daffodilDebugger.test.ts
index 1b40788..b8c731a 100644
--- a/src/tests/suite/daffodilDebugger.test.ts
+++ b/src/tests/suite/daffodilDebugger.test.ts
@@ -49,7 +49,7 @@
const debuggers: vscode.Terminal[] = []
const tdmlConf = {
- action: 'none',
+ action: 'generate',
name: 'tdmlConf',
description: 'testtdml',
path: TDML_PATH,
diff --git a/src/tests/suite/utils.test.ts b/src/tests/suite/utils.test.ts
index c306e58..4e15543 100644
--- a/src/tests/suite/utils.test.ts
+++ b/src/tests/suite/utils.test.ts
@@ -35,12 +35,6 @@
type: 'none',
path: '${workspaceFolder}/infoset.xml',
},
- tdmlConfig: {
- action: 'none',
- name: '${command:AskForTDMLName}',
- description: '${command:AskForTDMLDescription}',
- path: '${command:AskForTDMLPath}',
- },
stopOnEntry: true,
useExistingServer: false,
trace: true,
diff --git a/src/utils.ts b/src/utils.ts
index 186c31d..799bc15 100644
--- a/src/utils.ts
+++ b/src/utils.ts
@@ -100,7 +100,18 @@
openInfosetDiffView = false,
daffodilDebugClasspath: string = ''
) {
- return {
+ // Keep 'none' here as a default so that we don't always add the tdmlConfig block
+ let tdmlAction = defaultConf.get('tdmlAction', 'none')
+ let tdmlPropsNeeded = false
+ if (
+ tdmlAction === 'generate' ||
+ tdmlAction === 'append' ||
+ tdmlAction === 'execute'
+ ) {
+ tdmlPropsNeeded = true
+ }
+
+ let jsonConfig = {
name: name,
request: request,
type: type,
@@ -121,17 +132,6 @@
'${workspaceFolder}/infoset.xml'
),
},
- tdmlConfig: tdmlConfig
- ? tdmlConfig
- : {
- action: defaultConf.get('tdmlAction', 'none'),
- name: defaultConf.get('tdmlName', '${command:AskforTDMLName}'),
- description: defaultConf.get(
- 'tdmlDescription',
- '${command:AskForTDMLDescription}'
- ),
- path: defaultConf.get('tdmlPath', '${workspaceFolder}/infoset.tdml'),
- },
stopOnEntry: stopOnEntry
? stopOnEntry
: defaultConf.get('stopOnEntry', true),
@@ -162,6 +162,22 @@
logLevel: defaultConf.get('dataEditorLogLevel', 'info'),
},
}
+
+ if (tdmlPropsNeeded) {
+ jsonConfig['tdmlConfig'] = tdmlConfig
+ ? tdmlConfig
+ : {
+ action: tdmlAction,
+ name: defaultConf.get('tdmlName', '${command:AskforTDMLName}'),
+ description: defaultConf.get(
+ 'tdmlDescription',
+ '${command:AskForTDMLDescription}'
+ ),
+ path: defaultConf.get('tdmlPath', '${workspaceFolder}/infoset.tdml'),
+ }
+ }
+
+ return jsonConfig
}
export async function unzipFile(zipFilePath: string, extractPath: string) {