async function getTDMLConfig()

in src/daffodilDebugger/debugger.ts [41:100]


async function getTDMLConfig(
  config: vscode.DebugConfiguration
): Promise<boolean> {
  // If not supported TDML action entered, delete tdml config so no errors are thrown
  if (!['execute', 'generate', 'append'].includes(config?.tdmlConfig?.action)) {
    delete config.tdmlConfig
  }

  // If we are doing a TDML execute, these fields will be replaced,
  //   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
    //   away from the detected dfdl language in VSCode.
    config.data = ''
  }

  if (
    config?.tdmlConfig?.action === 'generate' ||
    config?.tdmlConfig?.action === 'append' ||
    config?.tdmlConfig?.action === 'execute'
  ) {
    if (
      config?.tdmlConfig?.name === undefined ||
      config?.tdmlConfig?.name.includes('${command:AskForTDMLName}')
    )
      config.tdmlConfig.name = await vscode.commands.executeCommand(
        'extension.dfdl-debug.getTDMLName'
      )

    if (
      config?.tdmlConfig?.description === undefined ||
      config?.tdmlConfig?.description.includes(
        '${command:AskForTDMLDescription}'
      )
    )
      config.tdmlConfig.description = await vscode.commands.executeCommand(
        'extension.dfdl-debug.getTDMLDescription'
      )

    if (
      config?.tdmlConfig?.path === undefined ||
      config?.tdmlConfig?.path.includes('${command:AskForTDMLPath}')
    )
      if (config?.tdmlConfig?.action === 'generate')
        config.tdmlConfig.path = await vscode.commands.executeCommand(
          'extension.dfdl-debug.getTDMLPath'
        )
      else
        config.tdmlConfig.path = await vscode.commands.executeCommand(
          'extension.dfdl-debug.getValidatedTDMLPath'
        )
  }

  if (config?.tdmlConfig?.action !== 'execute' && config.data === '') {
    return false
  }

  return true
}