async function getTDMLConfig()

in src/daffodilDebugger/debugger.ts [46:104]


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', 'none'].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 `schema` here if we move the `Execute TDML` command
    //   away from the detected dfdl language in VSCode.
    config.data = ''
    config.schema.path = ''

    if (config?.tdmlConfig?.path === undefined)
      config.tdmlConfig.path = await vscode.commands.executeCommand(
        'extension.dfdl-debug.getValidatedTDMLPath'
      )

    if (config?.tdmlConfig?.name === undefined)
      config.tdmlConfig.name = await vscode.commands.executeCommand(
        'extension.dfdl-debug.getTDMLName'
      )

    if (config?.tdmlConfig?.description === undefined)
      config.tdmlConfig.description = await vscode.commands.executeCommand(
        'extension.dfdl-debug.getTDMLDescription'
      )
  }

  if (config?.tdmlConfig?.action === 'generate') {
    if (
      config?.tdmlConfig?.name === undefined ||
      config?.tdmlConfig?.name === 'undefined'
    )
      config.tdmlConfig.name = getDefaultTDMLTestCaseName()

    if (
      config?.tdmlConfig?.description === undefined ||
      config?.tdmlConfig?.description === 'undefined'
    )
      config.tdmlConfig.description = getDefaultTDMLTestCaseDescription()

    if (
      config?.tdmlConfig?.path === undefined ||
      config?.tdmlConfig?.path === 'undefined'
    )
      config.tdmlConfig.path = getTmpTDMLFilePath()
  }

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

  return true
}