This is an automated email from the ASF dual-hosted git repository.
shanedell 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 3e518ec Added patch so "" would be treated same as ${AskForDataName}
or ${AskForSchemaName}
3e518ec is described below
commit 3e518ec86ba9c395f21aee20e4b4bacaca885494
Author: naga-panchumarty <[email protected]>
AuthorDate: Tue Oct 28 15:19:38 2025 -0400
Added patch so "" would be treated same as ${AskForDataName} or
${AskForSchemaName}
Closes https://github.com/apache/daffodil-vscode/issues/1411
---
src/adapter/activateDaffodilDebug.ts | 61 +++++++++++++++++++++++++++++++-----
1 file changed, 53 insertions(+), 8 deletions(-)
diff --git a/src/adapter/activateDaffodilDebug.ts
b/src/adapter/activateDaffodilDebug.ts
index 02ef6cf..474dd8f 100644
--- a/src/adapter/activateDaffodilDebug.ts
+++ b/src/adapter/activateDaffodilDebug.ts
@@ -595,11 +595,11 @@ class DaffodilConfigurationProvider
* Massage a debug configuration just before a debug session is being
launched,
* e.g. add all missing attributes to the debug configuration.
*/
- resolveDebugConfiguration(
+ async resolveDebugConfiguration(
folder: WorkspaceFolder | undefined,
config: DebugConfiguration,
token?: CancellationToken
- ): ProviderResult<DebugConfiguration> {
+ ): Promise<DebugConfiguration | undefined> {
// if launch.json is missing or empty
if (!config.type && !config.request && !config.name) {
config = getConfig({ name: 'Launch', request: 'launch', type: 'dfdl' })
@@ -609,12 +609,57 @@ class DaffodilConfigurationProvider
config.debugServer = 4711
}
- if (!config.schema) {
- return vscode.window
- .showInformationMessage('Cannot find a schema to debug')
- .then((_) => {
- return undefined // abort launch
- })
+ const schemaMissing = !config.schema?.path || config.schema.path === ''
+ const dataMissing = !config.data || config.data === ''
+
+ let schemaPath: string | undefined
+ let dataPath: string | undefined
+
+ // --- If either is missing, always prompt in the correct order ---
+ if (schemaMissing || dataMissing) {
+ // Always prompt for schema first
+ schemaPath = await vscode.commands.executeCommand<string>(
+ 'extension.dfdl-debug.getSchemaName'
+ )
+ if (!schemaPath) {
+ return undefined
+ }
+ config.schema.path = schemaPath
+
+ dataPath = await vscode.commands.executeCommand<string>(
+ 'extension.dfdl-debug.getDataName'
+ )
+ if (!dataPath) {
+ return undefined
+ }
+ config.data = dataPath
+ }
+
+ // --- Clean up placeholders safely (no accidental empty strings) ---
+ if (config.schema?.path?.includes('${command:AskForSchemaName}')) {
+ if (schemaPath && schemaPath.trim() !== '') {
+ config.schema.path = schemaPath
+ } else {
+ config.schema.path = config.schema.path.replace(
+ '${command:AskForSchemaName}',
+ ''
+ )
+ console.warn(
+ 'Schema placeholder removed but no schema file was selected.'
+ )
+ }
+ }
+
+ if (
+ typeof config.data === 'string' &&
+ config.data.includes('${command:AskForDataName}')
+ ) {
+ if (dataPath && dataPath.trim() !== '') {
+ config.data = dataPath
+ } else {
+ config.data = config.data.replace('${command:AskForDataName}', '')
+ console.warn('Data placeholder removed but no data file was selected.')
+ }
}
let dataFolder = config.data