michael-hoke commented on code in PR #1336:
URL: https://github.com/apache/daffodil-vscode/pull/1336#discussion_r2254905328
##########
src/adapter/activateDaffodilDebug.ts:
##########
@@ -168,35 +168,62 @@ function createDebugRunFileConfigs(
tdmlConfig.action = tdmlAction
if (tdmlAction === 'execute') {
- tdmlConfig.name = '${command:AskForTDMLName}'
- tdmlConfig.description = '${command:AskForTDMLDescription}'
- tdmlConfig.path = targetResource.fsPath
+ tdmlConfig.path = targetResource.fsPath.toString()
+
+ if (
+ tdmlConfig.path &&
+ path.extname(tdmlConfig.path).toLowerCase() == '.tdml'
+ ) {
+ tdmlConfig.name =
+ tdmlConfig.name ||
+ (await vscode.commands.executeCommand(
+ 'extension.dfdl-debug.getTDMLName',
+ tdmlConfig?.path
+ ))
+
+ tdmlConfig.description =
+ tdmlConfig.description ||
+ (await vscode.commands.executeCommand(
+ 'extension.dfdl-debug.getTDMLDescription',
+ tdmlConfig?.path
+ ))
+
+ if (!tdmlConfig.name || !tdmlConfig.description) {
+ vscode.window.showErrorMessage(
+ 'Error: no TDML test cases were found! Stopping debugging.'
+ )
+ return
+ }
+ } else {
+ vscode.window.showErrorMessage(
+ "Error: TDML file specified doesn't have correct TDML file
extension ().tdml)!"
+ )
+ return
+ }
Review Comment:
You don't need to (and shouldn't) be checking file name for .tdml. What
happens if they have a .tdml.xsd file, which is an extension that we recognize
as valid TDML?
You also don't need to use tdmlConfig? here - you are initializing
tdmlConfig above, so it will never be undefined here.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]