Rename setting program to schema
Closes #928
diff --git a/debugger/src/main/scala/org.apache.daffodil.debugger.dap/Parse.scala b/debugger/src/main/scala/org.apache.daffodil.debugger.dap/Parse.scala
index 12aed20..405e9e2 100644
--- a/debugger/src/main/scala/org.apache.daffodil.debugger.dap/Parse.scala
+++ b/debugger/src/main/scala/org.apache.daffodil.debugger.dap/Parse.scala
@@ -273,7 +273,7 @@
// Parse a launch config that has been found to not have a tdmlConfig object
def parseManual(arguments: JsonObject): EitherNel[String, LaunchArgs] =
(
- parseProgram(arguments),
+ parseSchema(arguments),
parseData(arguments),
parseStopOnEntry(arguments),
parseInfosetFormat(arguments),
@@ -302,7 +302,7 @@
Option(tdmlConfig.getAsJsonPrimitive("action")) match {
case None =>
(
- parseProgram(arguments),
+ parseSchema(arguments),
parseData(arguments),
parseStopOnEntry(arguments),
parseInfosetFormat(arguments),
@@ -314,7 +314,7 @@
action.getAsString() match {
case "generate" =>
(
- parseProgram(arguments),
+ parseSchema(arguments),
parseData(arguments),
parseStopOnEntry(arguments),
parseInfosetFormat(arguments),
@@ -327,7 +327,7 @@
).parMapN(LaunchArgs.TDMLConfig.Generate.apply)
case "append" =>
(
- parseProgram(arguments),
+ parseSchema(arguments),
parseData(arguments),
parseStopOnEntry(arguments),
parseInfosetFormat(arguments),
@@ -356,20 +356,20 @@
}
}
- // Parse the program field from the launch config
- // Returns an error if the program field is missing or is an invalid path
+ // Parse the schema field from the launch config
+ // Returns an error if the schema field is missing or is an invalid path
// A case where the user expects a new directory to be created is not a valid path
// eg. /path/to/<existing>/<non-existing>/file.tdml
//
// arguments: Launch config
- def parseProgram(arguments: JsonObject) =
- Option(arguments.getAsJsonPrimitive("program"))
- .toRight("missing 'program' field from launch request")
+ def parseSchema(arguments: JsonObject) =
+ Option(arguments.getAsJsonPrimitive("schema"))
+ .toRight("missing 'schema' field from launch request")
.flatMap(path =>
Either
.catchNonFatal(Paths.get(path.getAsString))
- .leftMap(t => s"'program' field from launch request is not a valid path: $t")
- .ensureOr(path => s"program file at $path doesn't exist")(_.toFile().exists())
+ .leftMap(t => s"'schema' field from launch request is not a valid path: $t")
+ .ensureOr(path => s"schema file at $path doesn't exist")(_.toFile().exists())
)
.toEitherNel
diff --git a/debugger/src/test/scala/org.apache.daffodil.debugger/ParseSuite.scala b/debugger/src/test/scala/org.apache.daffodil.debugger/ParseSuite.scala
index 5f74852..50811e4 100644
--- a/debugger/src/test/scala/org.apache.daffodil.debugger/ParseSuite.scala
+++ b/debugger/src/test/scala/org.apache.daffodil.debugger/ParseSuite.scala
@@ -24,7 +24,7 @@
val name = "Default Config"
val request = "launch"
val launchType = "dfdl"
- var program = Paths.get("./src/test/data/emptySchema.dfdl.xsd").toAbsolutePath().toString()
+ var schema = Paths.get("./src/test/data/emptySchema.dfdl.xsd").toAbsolutePath().toString()
var data = Paths.get("./src/test/data/emptyData.xml").toAbsolutePath().toString()
val debugServer = 4711
val infosetFormat = "xml"
@@ -46,7 +46,7 @@
var testTDMLObject = new JsonObject()
override def beforeEach(context: BeforeEach): Unit = {
- program = Paths.get("./src/test/data/emptySchema.dfdl.xsd").toAbsolutePath().toString()
+ schema = Paths.get("./src/test/data/emptySchema.dfdl.xsd").toAbsolutePath().toString()
data = Paths.get("./src/test/data/emptyData.xml").toAbsolutePath().toString()
infosetOutputType = "none"
infosetOutputPath = "testPath/infoset.xml"
@@ -61,12 +61,12 @@
assertEquals(Parse.Debugee.LaunchArgs.parse(testJsonObject).isRight, true)
}
- test("Parse failed - No Program") {
+ test("Parse failed - No Schema") {
buildJson()
- testJsonObject.remove("program")
+ testJsonObject.remove("schema")
val parseResult = Parse.Debugee.LaunchArgs.parse(testJsonObject)
assertEquals(parseResult.isLeft, true)
- assertEquals(parseResult.left.get.head, "missing 'program' field from launch request")
+ assertEquals(parseResult.left.get.head, "missing 'schema' field from launch request")
}
test("Parse failed - No data") {
@@ -141,12 +141,12 @@
)
}
- test("Parse failed - Invalid Program Path") {
- program = "badPath.dfdl.xsd"
+ test("Parse failed - Invalid Schema Path") {
+ schema = "badPath.dfdl.xsd"
buildJson()
val parseResult = Parse.Debugee.LaunchArgs.parse(testJsonObject)
assertEquals(parseResult.isLeft, true)
- assertEquals(parseResult.left.get.head, s"program file at $program doesn't exist")
+ assertEquals(parseResult.left.get.head, s"schema file at $schema doesn't exist")
}
test("Parse failed - infosetOutputType not file") {
@@ -171,7 +171,7 @@
testJsonObject.addProperty("name", name)
testJsonObject.addProperty("request", request)
testJsonObject.addProperty("type", launchType)
- testJsonObject.addProperty("program", program)
+ testJsonObject.addProperty("schema", schema)
testJsonObject.addProperty("data", data)
testJsonObject.addProperty("debugServer", debugServer)
testJsonObject.addProperty("infosetFormat", infosetFormat)
diff --git a/package.json b/package.json
index 40c4e10..daf9516 100644
--- a/package.json
+++ b/package.json
@@ -101,7 +101,7 @@
"onLanguage:dfdl",
"onDebugResolve:dfdl",
"onDebugDynamicConfigurations:dfdl",
- "onCommand:extension.dfdl-debug.getProgramName",
+ "onCommand:extension.dfdl-debug.getSchemaName",
"onCommand:extension.dfdl-debug.getDataName",
"onCommand:extension.dfdl-debug.runEditorContents",
"onCommand:extension.dfdl-debug.debugEditorContents",
@@ -338,14 +338,14 @@
"configurationAttributes": {
"launch": {
"required": [
- "program",
+ "schema",
"data"
],
"properties": {
- "program": {
+ "schema": {
"type": "string",
"description": "Absolute path to the DFDL schema file.",
- "default": "${command:AskForProgramName}"
+ "default": "${command:AskForSchemaName}"
},
"data": {
"type": "string",
@@ -462,7 +462,7 @@
"type": "dfdl",
"request": "launch",
"name": "Ask for file name",
- "program": "${command:AskForProgramName}",
+ "schema": "${command:AskForSchemaName}",
"stopOnEntry": true,
"data": "${command:AskForDataName}",
"infosetFormat": "xml",
@@ -506,7 +506,7 @@
"type": "dfdl",
"request": "launch",
"name": "Ask for file name",
- "program": "^\"\\${command:AskForProgramName}\"",
+ "schema": "^\"\\${command:AskForSchemaName}\"",
"stopOnEntry": true,
"data": "^\"\\${command:AskForDataName}\"",
"infosetFormat": "xml",
@@ -544,7 +544,7 @@
}
],
"variables": {
- "AskForProgramName": "extension.dfdl-debug.getProgramName",
+ "AskForSchemaName": "extension.dfdl-debug.getSchemaName",
"AskForDataName": "extension.dfdl-debug.getDataName",
"AskForTDMLName": "extension.dfdl-debug.getTDMLName",
"AskForTDMLDescription": "extension.dfdl-debug.getTDMLDescription",
@@ -561,10 +561,10 @@
"type": "string",
"default": "dfdl"
},
- "program": {
+ "schema": {
"type": "string",
"description": "Absolute path to the DFDL schema file.",
- "default": "${command:AskForProgramName}"
+ "default": "${command:AskForSchemaName}"
},
"data": {
"type": "string",
diff --git a/src/adapter/activateDaffodilDebug.ts b/src/adapter/activateDaffodilDebug.ts
index 3d2e927..76b3276 100644
--- a/src/adapter/activateDaffodilDebug.ts
+++ b/src/adapter/activateDaffodilDebug.ts
@@ -26,10 +26,10 @@
import { InlineDebugAdapterFactory } from './extension'
import * as dfdlExt from '../language/semantics/dfdlExt'
-/** Method to file path for program and data
+/** Method to file path for schema and data
* Details:
* Required so that the vscode api commands:
- * - extension.dfdl-debug.getProgramName
+ * - extension.dfdl-debug.getSchemaName
* - extension.dfdl-debug.getDataName
* can be sent a file instead of always opening up a prompt.
* Always makes it so the vscode api commands above are able
@@ -113,7 +113,7 @@
name: 'Run File',
request: 'launch',
type: 'dfdl',
- program: targetResource.fsPath,
+ schema: targetResource.fsPath,
data: false,
debugServer: false,
infosetFormat: 'xml',
@@ -194,7 +194,7 @@
}
),
vscode.commands.registerCommand(
- 'extension.dfdl-debug.getProgramName',
+ 'extension.dfdl-debug.getSchemaName',
async (fileRequested = null) => {
// Open native file explorer to allow user to select data file from anywhere on their machine
return await getFile(
@@ -297,7 +297,7 @@
name: 'Daffodil Launch',
request: 'launch',
type: 'dfdl',
- program: '${file}',
+ schema: '${file}',
data: false,
debugServer: false,
infosetFormat: 'xml',
@@ -321,7 +321,7 @@
name: 'Daffodil Launch',
request: 'launch',
type: 'dfdl',
- program: '${file}',
+ schema: '${file}',
data: false,
debugServer: false,
infosetFormat: 'xml',
@@ -438,9 +438,9 @@
config.debugServer = 4711
}
- if (!config.program) {
+ if (!config.schema) {
return vscode.window
- .showInformationMessage('Cannot find a program to debug')
+ .showInformationMessage('Cannot find a schema to debug')
.then((_) => {
return undefined // abort launch
})
@@ -457,7 +457,7 @@
}
if (
- !dataFolder.includes('${command:AskForProgramName}') &&
+ !dataFolder.includes('${command:AskForSchemaName}') &&
!dataFolder.includes('${command:AskForDataName}') &&
!dataFolder.includes('${workspaceFolder}') &&
vscode.workspace.workspaceFolders &&
diff --git a/src/adapter/daffodilDebug.ts b/src/adapter/daffodilDebug.ts
index da4fade..ec098cb 100644
--- a/src/adapter/daffodilDebug.ts
+++ b/src/adapter/daffodilDebug.ts
@@ -43,8 +43,8 @@
* The interface should always match this schema.
*/
interface ILaunchRequestArguments extends DebugProtocol.LaunchRequestArguments {
- /** An absolute path to the "program" to debug. */
- program: string
+ /** An absolute path to the "schema" to debug. */
+ schema: string
/** Automatically stop target after launch. If not specified, target does not stop. */
stopOnEntry?: boolean
/** enable logging the Debug Adapter Protocol */
@@ -246,8 +246,8 @@
// wait until configuration has finished (and configurationDoneRequest has been called)
await this._configurationDone.wait(1000)
- // start the program in the runtime
- await this._runtime.start(args.program, !!args.stopOnEntry, !!args.noDebug)
+ // start the schema in the runtime
+ await this._runtime.start(args.schema, !!args.stopOnEntry, !!args.noDebug)
this.sendResponse(response)
}
diff --git a/src/classes/vscode-launch.ts b/src/classes/vscode-launch.ts
index c714f76..cd56f24 100644
--- a/src/classes/vscode-launch.ts
+++ b/src/classes/vscode-launch.ts
@@ -24,7 +24,7 @@
name: string
request: string
type: string
- program: string | boolean
+ schema: string | boolean
data: string | boolean
debugServer: number | boolean
infosetFormat: string | null
diff --git a/src/daffodilDebugger/debugger.ts b/src/daffodilDebugger/debugger.ts
index 5bd7bef..2402eb4 100644
--- a/src/daffodilDebugger/debugger.ts
+++ b/src/daffodilDebugger/debugger.ts
@@ -50,7 +50,7 @@
// so we don't need to prompt for them now.
if (config?.tdmlConfig?.action === 'execute') {
// Erase the value of `data` so that we aren't prompted for it later
- // Might need to add `program` here if we move the `Execute TDML` command
+ // Might need to add `schema` here if we move the `Execute TDML` command
// away from the detected dfdl language in VSCode.
config.data = ''
}
@@ -155,10 +155,10 @@
if (vscode.workspace.workspaceFolders !== undefined) {
await stopDebugger()
- // Get program file before debugger starts to avoid timeout
- if (config.program.includes('${command:AskForProgramName}')) {
- config.program = await vscode.commands.executeCommand(
- 'extension.dfdl-debug.getProgramName'
+ // Get schema file before debugger starts to avoid timeout
+ if (config.schema.includes('${command:AskForSchemaName}')) {
+ config.schema = await vscode.commands.executeCommand(
+ 'extension.dfdl-debug.getSchemaName'
)
}
diff --git a/src/launchWizard/launchWizard.js b/src/launchWizard/launchWizard.js
index 7c72668..de8849a 100644
--- a/src/launchWizard/launchWizard.js
+++ b/src/launchWizard/launchWizard.js
@@ -64,7 +64,7 @@
'openInfosetDiffView'
).checked
const openInfosetView = document.getElementById('openInfosetView').checked
- const program = document.getElementById('program').value
+ const schema = document.getElementById('schema').value
const stopOnEntry = document.getElementById('stopOnEntry').checked
const trace = document.getElementById('trace').checked
const useExistingServer = document.getElementById('useExistingServer').checked
@@ -96,7 +96,7 @@
openHexView,
openInfosetDiffView,
openInfosetView,
- program,
+ schema,
stopOnEntry,
trace,
useExistingServer,
@@ -271,7 +271,7 @@
request: 'launch',
type: 'dfdl',
name: configValues.name,
- program: configValues.program,
+ schema: configValues.schema,
data: configValues.data,
debugServer: configValues.debugServer,
infosetFormat: configValues.infosetFormat,
@@ -327,7 +327,7 @@
request: 'launch',
type: 'dfdl',
name: `${configValues.name}`,
- program: configValues.program,
+ schema: configValues.schema,
data: configValues.data,
debugServer: configValues.debugServer,
infosetFormat: configValues.infosetFormat,
@@ -409,7 +409,7 @@
document.getElementById('openInfosetDiffView').checked =
config.openInfosetDiffView
document.getElementById('openInfosetView').checked = config.openInfosetView
- document.getElementById('program').value = config.program
+ document.getElementById('schema').value = config.schema
document.getElementById('stopOnEntry').checked = config.stopOnEntry
document.getElementById('trace').checked = config.trace
document.getElementById('useExistingServer').checked =
@@ -462,8 +462,8 @@
case 'dataUpdate':
document.getElementById('data').value = message.value
break
- case 'programUpdate':
- document.getElementById('program').value = message.value
+ case 'schemaUpdate':
+ document.getElementById('schema').value = message.value
break
case 'daffodilDebugClasspathUpdate':
await updateDaffodilDebugClasspath(message)
diff --git a/src/launchWizard/launchWizard.ts b/src/launchWizard/launchWizard.ts
index f7908e3..7443bdf 100644
--- a/src/launchWizard/launchWizard.ts
+++ b/src/launchWizard/launchWizard.ts
@@ -555,11 +555,11 @@
</p>
</div>
- <div id="programDiv" class="setting-div">
+ <div id="schemaDiv" class="setting-div">
<p>Main Schema File:</p>
<p class="setting-description">Absolute path to the DFDL schema file.</p>
- <input class="file-input" value="${defaultValues.program}" id="program"/>
- <button id="programBrowse" class="browse-button" type="button" onclick="filePicker('program', 'Select DFDL schema to debug')">Browse</button>
+ <input class="file-input" value="${defaultValues.schema}" id="schema"/>
+ <button id="schemaBrowse" class="browse-button" type="button" onclick="filePicker('schema', 'Select DFDL schema to debug')">Browse</button>
</div>
<div id="dataDiv" class="setting-div">
diff --git a/src/tests/suite/daffodil.test.ts b/src/tests/suite/daffodil.test.ts
index 75fe53a..d29d4e7 100644
--- a/src/tests/suite/daffodil.test.ts
+++ b/src/tests/suite/daffodil.test.ts
@@ -223,22 +223,22 @@
})
suite('getCommands', () => {
- test('getProgramName file exists', async () => {
+ test('getSchemaName file exists', async () => {
assert.strictEqual(
await vscode.commands.executeCommand(
- 'extension.dfdl-debug.getProgramName',
+ 'extension.dfdl-debug.getSchemaName',
TEST_SCHEMA
),
TEST_SCHEMA
)
})
- test('getProgramName file does not exists', async () => {
+ test('getSchemaName file does not exists', async () => {
let file = path.join(__dirname, '../data/test.dfdl.xsd')
assert.notStrictEqual(
await vscode.commands.executeCommand(
- 'extension.dfdl-debug.getProgramName',
+ 'extension.dfdl-debug.getSchemaName',
file
),
file
diff --git a/src/tests/suite/daffodilDebugger.test.ts b/src/tests/suite/daffodilDebugger.test.ts
index 3fbe338..6995a18 100644
--- a/src/tests/suite/daffodilDebugger.test.ts
+++ b/src/tests/suite/daffodilDebugger.test.ts
@@ -119,7 +119,7 @@
name: 'Run',
request: 'launch',
type: 'dfdl',
- program: TEST_SCHEMA,
+ schema: TEST_SCHEMA,
data: DATA,
debugServer: 4711,
infosetFormat: 'xml',
@@ -145,7 +145,7 @@
name: 'Run',
request: 'launch',
type: 'dfdl',
- program: TEST_SCHEMA,
+ schema: TEST_SCHEMA,
data: DATA,
debugServer: 4712,
infosetFormat: 'json',
diff --git a/src/tests/suite/dataEditor.test.ts b/src/tests/suite/dataEditor.test.ts
index 95d1178..50bb59a 100644
--- a/src/tests/suite/dataEditor.test.ts
+++ b/src/tests/suite/dataEditor.test.ts
@@ -111,10 +111,9 @@
after(async () => {
assert.strictEqual(fs.existsSync(pidFile), true)
- assert.strictEqual(
- await stopServerUsingPID(parseInt(fs.readFileSync(pidFile).toString())),
- true
- )
+ const pid = parseInt(fs.readFileSync(pidFile).toString())
+ console.log(pid)
+ assert.strictEqual(await stopServerUsingPID(pid), true)
})
test('is running', async () => {
diff --git a/src/tests/suite/utils.test.ts b/src/tests/suite/utils.test.ts
index 3fc3151..41534ae 100644
--- a/src/tests/suite/utils.test.ts
+++ b/src/tests/suite/utils.test.ts
@@ -28,7 +28,7 @@
name: 'Default Config',
request: 'launch',
type: 'dfdl',
- program: '${command:AskForProgramName}',
+ schema: '${command:AskForSchemaName}',
data: '${command:AskForDataName}',
debugServer: 4711,
infosetFormat: 'xml',
diff --git a/src/utils.ts b/src/utils.ts
index d643b74..320fa58 100644
--- a/src/utils.ts
+++ b/src/utils.ts
@@ -87,7 +87,7 @@
const defaultConf = vscode.workspace.getConfiguration()
const defaultValues = {
- program: defaultConf.get('program', '${command:AskForProgramName}'),
+ schema: defaultConf.get('schema', '${command:AskForSchemaName}'),
data: defaultConf.get('data', '${command:AskForDataName}'),
debugServer: defaultConf.get('debugServer', 4711),
infosetFormat: 'xml',