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 f407a27  - Remove Description from being used to select a TDML Test 
Case - Remove Description from the launch config, even for generate - Remove 
dead TDML append-related code in the backend - Fix a bug where execute wouldn't 
work from the TDML GUI
f407a27 is described below

commit f407a27a91952f2f28d63194b04497ba18f6832e
Author: Michael Hoke <michael.h...@nteligen.com>
AuthorDate: Thu Jul 31 11:49:30 2025 -0400

    - Remove Description from being used to select a TDML Test Case
    - Remove Description from the launch config, even for generate
    - Remove dead TDML append-related code in the backend
    - Fix a bug where execute wouldn't work from the TDML GUI
---
 .../org.apache.daffodil.debugger.dap/Parse.scala   | 96 ++--------------------
 .../main/scala/org.apache.daffodil.tdml/TDML.scala | 83 +++----------------
 .../org.apache.daffodil.debugger/ParseSuite.scala  | 11 ---
 .../scala/org.apache.daffodil.tdml/TDMLSuite.scala | 46 +++--------
 package.json                                       |  8 --
 src/adapter/activateDaffodilDebug.ts               | 63 ++++----------
 src/classes/tdmlConfig.ts                          |  1 -
 src/daffodilDebugger/debugger.ts                   | 14 ----
 src/launchWizard/launchWizard.ts                   |  7 --
 src/launchWizard/script.js                         | 17 ----
 src/tdmlEditor/TDMLProvider.ts                     | 21 +++++
 src/tdmlEditor/utilities/tdmlXmlUtils.ts           |  4 -
 src/tests/suite/utils.test.ts                      |  1 -
 src/utils.ts                                       | 42 +++-------
 14 files changed, 76 insertions(+), 338 deletions(-)

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 256b339..cf6dd5b 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
@@ -269,22 +269,6 @@ object Parse {
             infosetFormat: String,
             infosetOutput: LaunchArgs.InfosetOutput,
             name: String,
-            description: String,
-            path: String,
-            rootName: Option[String],
-            rootNamespace: Option[String],
-            variables: Map[String, String],
-            tunables: Map[String, String]
-        ) extends TDMLConfig
-
-        case class Append(
-            schemaPath: Path,
-            dataPath: Path,
-            stopOnEntry: Boolean,
-            infosetFormat: String,
-            infosetOutput: LaunchArgs.InfosetOutput,
-            name: String,
-            description: String,
             path: String,
             rootName: Option[String],
             rootNamespace: Option[String],
@@ -297,7 +281,6 @@ object Parse {
             infosetFormat: String,
             infosetOutput: LaunchArgs.InfosetOutput,
             name: String,
-            description: String,
             path: String,
             rootName: Option[String],
             rootNamespace: Option[String],
@@ -335,7 +318,6 @@ object Parse {
     // tdmlConfig: {
     //   action: '',
     //   name: '',
-    //   description: '',
     //   path: ''
     // }
     //
@@ -369,7 +351,6 @@ object Parse {
                 parseInfosetFormat(arguments),
                 parseInfosetOutput(arguments, true),
                 parseTDMLName(tdmlConfig),
-                parseTDMLDescription(tdmlConfig),
                 parseTDMLPath(tdmlConfig),
                 parseRootName(arguments),
                 parseRootNamespace(arguments),
@@ -382,7 +363,6 @@ object Parse {
                 parseInfosetFormat(arguments),
                 parseInfosetOutput(arguments),
                 parseTDMLName(tdmlConfig),
-                parseTDMLDescription(tdmlConfig),
                 parseTDMLPath(tdmlConfig),
                 parseRootName(arguments),
                 parseRootNamespace(arguments),
@@ -573,7 +553,6 @@ object Parse {
     // tdmlConfig: {
     //   action: '',
     //   name: '',
-    //   description: '',
     //   path: ''
     // }
     //
@@ -591,20 +570,6 @@ object Parse {
         .flatMap(name => Either.cond(name.length() > 0, name, "'name' field 
from 'tdmlConfig' object cannot be empty"))
         .toEitherNel
 
-    // Parse the description field from the tdmlConfig object from the launch 
config
-    // Returns an error if the field is missing or is an empty string
-    //
-    // tdmlConfig: tdmlConfig object from the launch config
-    def parseTDMLDescription(tdmlConfig: JsonObject) =
-      Option(tdmlConfig.getAsJsonPrimitive("description"))
-        .toRight("missing 'tdmlConfig.description' field from launch request")
-        .map(_.getAsString())
-        .flatMap(description =>
-          Either
-            .cond(description.length() > 0, description, "'description' field 
from 'tdmlConfig' object cannot be empty")
-        )
-        .toEitherNel
-
     // Parse the path field from the tdmlConfig object from the launch config
     // Returns an error if the 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
@@ -646,7 +611,6 @@ object Parse {
               infosetFormat,
               infosetOutput,
               name,
-              description,
               tdmlPath,
               rootName,
               rootNamespace,
@@ -670,7 +634,7 @@ object Parse {
         ).onFinalize(
           infosetOutput match {
             case Debugee.LaunchArgs.InfosetOutput.File(path) =>
-              IO(TDML.generate(path, schemaPath, dataPath, name, description, 
tdmlPath))
+              IO(TDML.generate(path, schemaPath, dataPath, name, tdmlPath))
             case _ =>
               // This case should never be hit. Validation is being done on 
launch config prior to
               //   this section of code attempting to run a DFDL operation. If 
the user is trying to
@@ -679,54 +643,12 @@ object Parse {
               IO.unit
           }
         )
-      case Debugee.LaunchArgs.TDMLConfig
-            .Append(
-              schemaPath,
-              dataPath,
-              stopOnEntry,
-              infosetFormat,
-              infosetOutput,
-              name,
-              description,
-              tdmlPath,
-              rootName,
-              rootNamespace,
-              variables,
-              tunables
-            ) =>
-        // Create a LaunchArgs.Manual, run the debugee with it, and then 
append to the existing TDML file
-        debugee(
-          Debugee.LaunchArgs
-            .Manual(
-              schemaPath,
-              dataPath,
-              stopOnEntry,
-              infosetFormat,
-              infosetOutput,
-              rootName,
-              rootNamespace,
-              variables,
-              tunables
-            )
-        ).onFinalize(
-          infosetOutput match {
-            case Debugee.LaunchArgs.InfosetOutput.File(path) =>
-              IO(TDML.append(path, schemaPath, dataPath, name, description, 
tdmlPath))
-            case _ =>
-              // This case should never be hit. Validation is being done on 
launch config prior to
-              //   this section of code attempting to run a DFDL operation. If 
the user is trying to
-              //   append to a TDML file and an infosetOutput type of 'none' | 
'console' is selected,
-              //   an error will be displayed, and the execution will be 
aborted, before the DFDL operation begins.
-              IO.unit
-          }
-        )
       case Debugee.LaunchArgs.TDMLConfig
             .Execute(
               stopOnEntry,
               infosetFormat,
               infosetOutput,
               name,
-              description,
               tdmlPath,
               rootName,
               rootNamespace,
@@ -734,10 +656,10 @@ object Parse {
               tunables
             ) =>
         // From a TDML file, create a LaunchArgs.Manual from the named test, 
run the debugee with it
-        Resource.eval(IO(TDML.execute(name, description, tdmlPath))).flatMap {
+        Resource.eval(IO(TDML.execute(name, tdmlPath))).flatMap {
           case None =>
             Resource.raiseError[IO, Debugee, Throwable](
-              new RuntimeException(s"couldn't execute TDML with name $name, 
description $description, path $tdmlPath")
+              new RuntimeException(s"couldn't execute TDML with name $name, 
path $tdmlPath")
             )
           case Some((schemaPath, dataPath)) =>
             debugee(
@@ -1208,17 +1130,15 @@ object Parse {
           variables: Map[String, String],
           tunables: Map[String, String]
       ) extends LaunchArgs
-      case class TDMLConfig(action: String, name: String, description: String, 
path: String) extends LaunchArgs
+      case class TDMLConfig(action: String, name: String, path: String) 
extends LaunchArgs
 
       object TDMLConfig {
         def apply(that: Debugee.LaunchArgs.TDMLConfig): TDMLConfig =
           that match {
-            case Debugee.LaunchArgs.TDMLConfig.Generate(_, _, _, _, _, name, 
description, path, _, _, _, _) =>
-              TDMLConfig("generate", name, description, path)
-            case Debugee.LaunchArgs.TDMLConfig.Append(_, _, _, _, _, name, 
description, path, _, _, _, _) =>
-              TDMLConfig("append", name, description, path)
-            case Debugee.LaunchArgs.TDMLConfig.Execute(_, _, _, name, 
description, path, _, _, _, _) =>
-              TDMLConfig("execute", name, description, path)
+            case Debugee.LaunchArgs.TDMLConfig.Generate(_, _, _, _, _, name, 
path, _, _, _, _) =>
+              TDMLConfig("generate", name, path)
+            case Debugee.LaunchArgs.TDMLConfig.Execute(_, _, _, name, path, _, 
_, _, _) =>
+              TDMLConfig("execute", name, path)
           }
       }
     }
diff --git a/debugger/src/main/scala/org.apache.daffodil.tdml/TDML.scala 
b/debugger/src/main/scala/org.apache.daffodil.tdml/TDML.scala
index 1eb87a3..e450b39 100644
--- a/debugger/src/main/scala/org.apache.daffodil.tdml/TDML.scala
+++ b/debugger/src/main/scala/org.apache.daffodil.tdml/TDML.scala
@@ -27,10 +27,14 @@ import scala.jdk.CollectionConverters._
 import org.apache.daffodil.lib.xml.XMLUtils
 
 object TDML {
+  def getDefaultTDMLTestCaseDescription(): String =
+    return "Generated by DFDL VSCode Extension"
+
   // Create a ParserTestCaseType object that can be put into a TestSuite
   // These types are generated when JAXB is executed on the TDML schema
   //
-  // The format of the new ParserTestCase is as follows:
+  // The format of the new ParserTestCase is as follows. $tdmlDescription is 
set to a default value and will be
+  //   editable by users after the TDML file gets created:
   //
   // <tdml:parserTestCase name="$tdmlName" root="file" model="$schemaPath" 
description="$tdmlDescription" roundTrip="onePass">
   //   <tdml:document>
@@ -45,15 +49,13 @@ object TDML {
   // dataPath:        Path to the data file
   // schemaPath:      Path to the DFDL Schema
   // tdmlName:        Name of the DFDL operation
-  // tdmlDescription: Description for the DFDL operation
   //
   // Returns the ParserTestCase object created with the applied paths
   def createTestCase(
       infosetPath: String,
       schemaPath: String,
       dataPath: String,
-      tdmlName: String,
-      tdmlDescription: String
+      tdmlName: String
   ): ParserTestCaseType = {
     val factory = new ObjectFactory()
 
@@ -84,7 +86,7 @@ object TDML {
     testCase.setName(tdmlName)
     testCase.setRoot("file")
     testCase.setModel(schemaPath)
-    testCase.setDescription(tdmlDescription)
+    testCase.setDescription(getDefaultTDMLTestCaseDescription())
     testCase.setRoundTrip(RoundTripType.ONE_PASS)
     testCase.getTutorialOrDocumentOrInfoset().add(doc)
     testCase.getTutorialOrDocumentOrInfoset().add(infoset)
@@ -129,14 +131,12 @@ object TDML {
   // schemaPath:      Path to the DFDL Schema
   // dataPath:        Path to the data file
   // tdmlName:        Name of the DFDL operation
-  // tdmlDescription: Description for the DFDL operation
   // tdmlPath:        Path to the TDML file
   def generate(
       infosetPath: Path,
       schemaPath: Path,
       dataPath: Path,
       tdmlName: String,
-      tdmlDescription: String,
       tdmlPath: String
   ): Unit =
     TDML.generate(
@@ -144,7 +144,6 @@ object TDML {
       convertToRelativePath(schemaPath, tdmlPath),
       convertToRelativePath(dataPath, tdmlPath),
       tdmlName,
-      tdmlDescription,
       tdmlPath
     )
 
@@ -156,7 +155,6 @@ object TDML {
   // schemaPath:      Path to the DFDL Schema
   // dataPath:        Path to the data file
   // tdmlName:        Name of the DFDL operation
-  // tdmlDescription: Description for the DFDL operation
   // tdmlPath:        Path to the TDML file
   //
   // There is a suiteName attribute in the root element of the document. This 
is set to tdmlName
@@ -165,7 +163,6 @@ object TDML {
       schemaPath: String,
       dataPath: String,
       tdmlName: String,
-      tdmlDescription: String,
       tdmlPath: String
   ): Unit = {
     val factory = new ObjectFactory()
@@ -175,66 +172,7 @@ object TDML {
     testSuite.setDefaultRoundTrip(RoundTripType.ONE_PASS)
     testSuite
       .getTutorialOrParserTestCaseOrDefineSchema()
-      .add(createTestCase(infosetPath, schemaPath, dataPath, tdmlName, 
tdmlDescription))
-
-    val marshaller = 
JAXBContext.newInstance(classOf[TestSuite]).createMarshaller()
-    marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true)
-    marshaller.marshal(testSuite, new java.io.File(tdmlPath))
-  }
-
-  // Append a new test case to an existing TDML file.
-  // Paths given to this function should be absolute as they will be converted 
to relative paths
-  //
-  // infosetPath:     Path to the infoset
-  // schemaPath:      Path to the DFDL Schema
-  // dataPath:        Path to the data file
-  // tdmlName:        Name of the DFDL operation
-  // tdmlDescription: Description for the DFDL operation
-  // tdmlPath:        Path to the TDML file
-  def append(
-      infosetPath: Path,
-      schemaPath: Path,
-      dataPath: Path,
-      tdmlName: String,
-      tdmlDescription: String,
-      tdmlPath: String
-  ): Unit =
-    append(
-      convertToRelativePath(infosetPath, tdmlPath),
-      convertToRelativePath(schemaPath, tdmlPath),
-      convertToRelativePath(dataPath, tdmlPath),
-      tdmlName,
-      tdmlDescription,
-      tdmlPath
-    )
-
-  // Append a new test case to an existing TDML file.
-  // Paths given to this function should be relative as it should be expected 
for the TDML files to be shared on the mailing list
-  //
-  // infosetPath:     Path to the infoset
-  // schemaPath:      Path to the DFDL Schema
-  // dataPath:        Path to the data file
-  // tdmlName:        Name of the DFDL operation
-  // tdmlDescription: Description for the DFDL operation
-  // tdmlPath:        Path to the TDML file
-  def append(
-      infosetPath: String,
-      schemaPath: String,
-      dataPath: String,
-      tdmlName: String,
-      tdmlDescription: String,
-      tdmlPath: String
-  ): Unit = {
-
-    val testSuite = JAXBContext
-      .newInstance(classOf[TestSuite])
-      .createUnmarshaller()
-      .unmarshal(new File(tdmlPath))
-      .asInstanceOf[TestSuite]
-
-    testSuite
-      .getTutorialOrParserTestCaseOrDefineSchema()
-      .add(createTestCase(infosetPath, schemaPath, dataPath, tdmlName, 
tdmlDescription))
+      .add(createTestCase(infosetPath, schemaPath, dataPath, tdmlName))
 
     val marshaller = 
JAXBContext.newInstance(classOf[TestSuite]).createMarshaller()
     marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true)
@@ -244,12 +182,11 @@ object TDML {
   // Find the parameters needed to execute a DFDL parse based on the given 
TDML Parameters
   //
   // tdmlName:        Test case name to run
-  // tdmlDescription: Description of test case to run
   // tdmlPath:        File path of TDML file to extract test case from
   //
   // Returns a tuple containing the following (Path to DFDL Schema, Path to 
Data File)
   // All paths returned could be either relative or absolute - it depends on 
what exists in the TDML file
-  def execute(tdmlName: String, tdmlDescription: String, tdmlPath: String): 
Option[(Path, Path)] = {
+  def execute(tdmlName: String, tdmlPath: String): Option[(Path, Path)] = {
     val basePath = Paths.get(tdmlPath).toAbsolutePath().getParent().toString()
 
     val testCaseList = JAXBContext
@@ -262,7 +199,7 @@ object TDML {
       .toList
 
     testCaseList.collectFirst {
-      case (ptc: ParserTestCaseType) if ptc.getName() == tdmlName && 
ptc.getDescription() == tdmlDescription =>
+      case (ptc: ParserTestCaseType) if ptc.getName() == tdmlName =>
         ptc.getTutorialOrDocumentOrInfoset().asScala.collectFirst { case doc: 
DocumentType =>
           // The right part of the tuple only takes the first DocumentPart 
inside the Document.
           // In the case that there are more than one, any extras will be 
ignored.
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 e16391c..1caabb0 100644
--- a/debugger/src/test/scala/org.apache.daffodil.debugger/ParseSuite.scala
+++ b/debugger/src/test/scala/org.apache.daffodil.debugger/ParseSuite.scala
@@ -33,7 +33,6 @@ class ParseSuite extends FunSuite {
   var infosetOutputPath = "testPath/infoset.xml"
   var tdmlAction = ""
   val tdmlName = "Test TDML Name"
-  val tdmlDescription = "Test TDML Description"
   val tdmlPath = "testPath/test.tdml"
   val stopOnEntry = true
   val useExistingServer = false
@@ -113,15 +112,6 @@ class ParseSuite extends FunSuite {
     assertEquals(parseResult.swap.toOption.map(_.head).getOrElse("no error"), 
"missing 'tdmlConfig.name' field from launch request")
   }
 
-  test("Parse failed - invalid tdmlConfig - no description") {
-    tdmlAction = "generate"
-    buildJson()
-    testTDMLObject.remove("description")
-    val parseResult = Parse.Debugee.parseTDMLDescription(testTDMLObject)
-    assertEquals(parseResult.isLeft, true)
-    assertEquals(parseResult.swap.toOption.map(_.head).getOrElse("no error"), 
"missing 'tdmlConfig.description' field from launch request")
-  }
-
   test("Parse failed - invalid tdmlConfig - no path") {
     tdmlAction = "generate"
     buildJson()
@@ -167,7 +157,6 @@ class ParseSuite extends FunSuite {
 
     testTDMLObject.addProperty("action", tdmlAction)
     testTDMLObject.addProperty("name", tdmlName)
-    testTDMLObject.addProperty("description", tdmlDescription)
     testTDMLObject.addProperty("path", tdmlPath)
 
     testJsonObject.addProperty("name", name)
diff --git a/debugger/src/test/scala/org.apache.daffodil.tdml/TDMLSuite.scala 
b/debugger/src/test/scala/org.apache.daffodil.tdml/TDMLSuite.scala
index 09fcdb0..2e13896 100644
--- a/debugger/src/test/scala/org.apache.daffodil.tdml/TDMLSuite.scala
+++ b/debugger/src/test/scala/org.apache.daffodil.tdml/TDMLSuite.scala
@@ -34,14 +34,15 @@ class TDMLSuite extends munit.FunSuite {
   val dataPath = 
Paths.get("./debugger/src/test/data/emptyData.xml").toAbsolutePath()
   val notInfosetPath = 
Paths.get("./debugger/src/test/data/notInfoset.xml").toAbsolutePath()
   val tdmlName = "TestTDMLName"
-  val tdmlDescription = "Test TDML Description"
+  val tdmlDescription = TDML.getDefaultTDMLTestCaseDescription()
   val tdmlPath = Paths.get("./testTDML.tdml").toAbsolutePath()
   val expectedNSHashSet = HashSet[String](
     "http://www.ibm.com/xmlns/dfdl/testData";
   )
-  val tdmlSingleTestCase = """<?xml version="1.0" encoding="UTF-8" 
standalone="yes"?>
+  val tdmlSingleTestCase = s"""<?xml version="1.0" encoding="UTF-8" 
standalone="yes"?>
 <ns1:testSuite xmlns:ns1="http://www.ibm.com/xmlns/dfdl/testData"; 
suiteName="TestTDMLName" defaultRoundTrip="onePass">
-    <ns1:parserTestCase name="TestTDMLName" root="file" 
model="debugger/src/test/data/emptySchema.xml" roundTrip="onePass" 
description="Test TDML Description">
+    <ns1:parserTestCase name="TestTDMLName" root="file" 
model="debugger/src/test/data/emptySchema.xml" roundTrip="onePass" 
description="${TDML
+      .getDefaultTDMLTestCaseDescription()}">
         <ns1:document>
             <ns1:documentPart 
type="file">debugger/src/test/data/emptyData.xml</ns1:documentPart>
         </ns1:document>
@@ -50,9 +51,10 @@ class TDMLSuite extends munit.FunSuite {
         </ns1:infoset>
     </ns1:parserTestCase>
 </ns1:testSuite>"""
-  val tdmlDoubleTestCase = """<?xml version="1.0" encoding="UTF-8" 
standalone="yes"?>
+  val tdmlDoubleTestCase = s"""<?xml version="1.0" encoding="UTF-8" 
standalone="yes"?>
 <ns1:testSuite xmlns:ns1="http://www.ibm.com/xmlns/dfdl/testData"; 
suiteName="TestTDMLName" defaultRoundTrip="onePass">
-    <ns1:parserTestCase name="TestTDMLName" root="file" 
model="debugger/src/test/data/emptySchema.xml" roundTrip="onePass" 
description="Test TDML Description">
+    <ns1:parserTestCase name="TestTDMLName" root="file" 
model="debugger/src/test/data/emptySchema.xml" roundTrip="onePass" 
description="${TDML
+      .getDefaultTDMLTestCaseDescription()}">
         <ns1:document>
             <ns1:documentPart 
type="file">debugger/src/test/data/emptyData.xml</ns1:documentPart>
         </ns1:document>
@@ -75,7 +77,7 @@ class TDMLSuite extends munit.FunSuite {
   override def afterEach(context: AfterEach): Unit = { val _ = 
tdmlPath.toFile.delete() }
 
   test("Test Generate") {
-    TDML.generate(infosetPath, schemaPath, dataPath, tdmlName, 
tdmlDescription, tdmlPath.toString())
+    TDML.generate(infosetPath, schemaPath, dataPath, tdmlName, 
tdmlPath.toString())
 
     val content = readString(tdmlPath)
     val contentXml = XML.loadString(content)
@@ -86,7 +88,7 @@ class TDMLSuite extends munit.FunSuite {
   }
 
   test(name = "Negative Generate") {
-    TDML.generate(notInfosetPath, schemaPath, dataPath, tdmlName, 
tdmlDescription, tdmlPath.toString())
+    TDML.generate(notInfosetPath, schemaPath, dataPath, tdmlName, 
tdmlPath.toString())
 
     val content = readString(tdmlPath)
     val contentXml = XML.loadString(content)
@@ -96,36 +98,12 @@ class TDMLSuite extends munit.FunSuite {
     assertNotEquals(contentXml, tdmlSingleTestCaseXml)
   }
 
-  test("Test Append") {
-    TDML.generate(infosetPath, schemaPath, dataPath, tdmlName, 
tdmlDescription, tdmlPath.toString())
-    TDML.append(infosetPath, schemaPath, dataPath, tdmlName, tdmlDescription, 
tdmlPath.toString())
-
-    val content = readString(tdmlPath)
-    val contentXml = XML.loadString(content)
-
-    // Validate the namespaces as well. If they ever get placed out of order, 
this test can act as a canary.
-    assertEquals(getNamespaces(contentXml), expectedNSHashSet)
-    assertEquals(contentXml, tdmlDoubleTestCaseXml)
-  }
-
-  test("Negative Append") {
-    TDML.generate(infosetPath, schemaPath, dataPath, tdmlName, 
tdmlDescription, tdmlPath.toString())
-    TDML.append(notInfosetPath, schemaPath, dataPath, tdmlName, 
tdmlDescription, tdmlPath.toString())
-
-    val content = readString(tdmlPath)
-    val contentXml = XML.loadString(content)
-
-    // Validate the namespaces as well. If they ever get placed out of order, 
this test can act as a canary.
-    assertEquals(getNamespaces(contentXml), expectedNSHashSet)
-    assertNotEquals(contentXml, tdmlDoubleTestCaseXml)
-  }
-
   test("Test Execute") {
     val schemaPathExecute = schemaPath
     val dataPathExecute = dataPath
 
-    TDML.generate(infosetPath, schemaPath, dataPath, tdmlName, 
tdmlDescription, tdmlPath.toString())
-    val executePaths = TDML.execute(tdmlName, tdmlDescription, 
tdmlPath.toAbsolutePath().toString())
+    TDML.generate(infosetPath, schemaPath, dataPath, tdmlName, 
tdmlPath.toString())
+    val executePaths = TDML.execute(tdmlName, 
tdmlPath.toAbsolutePath().toString())
 
     assertEquals(executePaths, Option[(Path, 
Path)]((schemaPathExecute.normalize(), dataPathExecute.normalize())))
   }
@@ -138,7 +116,7 @@ class TDMLSuite extends munit.FunSuite {
 
   test("Test createTestCase") {
     val testCase =
-      TDML.createTestCase(infosetPath.toString(), schemaPath.toString(), 
dataPath.toString(), tdmlName, tdmlDescription)
+      TDML.createTestCase(infosetPath.toString(), schemaPath.toString(), 
dataPath.toString(), tdmlName)
 
     assertEquals(testCase.getDescription.toString(), tdmlDescription)
     assertEquals(testCase.getName.toString(), tdmlName)
diff --git a/package.json b/package.json
index 2e08320..0a9a4be 100644
--- a/package.json
+++ b/package.json
@@ -119,7 +119,6 @@
     "onCommand:extension.dfdl-debug.executeTDML",
     "onCommand:extension.dfdl-debug.copyTDML",
     "onCommand:extension.dfdl-debug.getTDMLName",
-    "onCommand:extension.dfdl-debug.getTDMLDescription",
     "onCommand:extension.dfdl-debug.getTDMLPath",
     "onCommand:extension.dfdl-debug.getValidatedTDMLPath",
     "onCommand:extension.dfdl-debug.getValidatedTDMLCopyPath",
@@ -581,11 +580,6 @@
                     "default": "",
                     "description": "TDML Case Name"
                   },
-                  "description": {
-                    "type": "string",
-                    "default": "",
-                    "description": "TDML Case Description"
-                  },
                   "path": {
                     "type": "string",
                     "default": "${command:AskForTDMLPath}",
@@ -828,8 +822,6 @@
         "variables": {
           "AskForSchemaName": "extension.dfdl-debug.getSchemaName",
           "AskForDataName": "extension.dfdl-debug.getDataName",
-          "AskForTDMLName": "extension.dfdl-debug.getTDMLName",
-          "AskForTDMLDescription": "extension.dfdl-debug.getTDMLDescription",
           "AskForTDMLPath": "extension.dfdl-debug.getTDMLPath",
           "AskForValidatedTDMLPath": 
"extension.dfdl-debug.getValidatedTDMLPath",
           "AskForValidatedTDMLCopyPath": 
"extension.dfdl-debug.getValidatedTDMLCopyPath"
diff --git a/src/adapter/activateDaffodilDebug.ts 
b/src/adapter/activateDaffodilDebug.ts
index b3651ab..f208032 100644
--- a/src/adapter/activateDaffodilDebug.ts
+++ b/src/adapter/activateDaffodilDebug.ts
@@ -43,6 +43,7 @@ import {
 import xmlFormat from 'xml-formatter'
 import { CommandsProvider } from '../views/commands'
 import * as daffodilDebugErrors from './daffodilDebugErrors'
+import { TDMLProvider } from 'tdmlEditor/TDMLProvider'
 
 export const outputChannel: vscode.OutputChannel =
   vscode.window.createOutputChannel('Daffodil')
@@ -143,12 +144,17 @@ async function createDebugRunFileConfigs(
   tdmlAction: string | undefined,
   runLast = false
 ) {
-  let targetResource = resource
+  let targetResource: vscode.Uri | undefined = resource
   let noDebug = runOrDebug === 'run'
 
-  if (!targetResource && vscode.window.activeTextEditor) {
-    targetResource = vscode.window.activeTextEditor.document.uri
+  if (!targetResource) {
+    if (vscode.window.activeTextEditor) {
+      targetResource = vscode.window.activeTextEditor.document.uri
+    } else if (TDMLProvider.getDocumentUri()) {
+      targetResource = TDMLProvider.getDocumentUri()
+    }
   }
+
   if (targetResource) {
     let infosetFile = `${
       path.basename(targetResource.fsPath).split('.')[0]
@@ -168,7 +174,7 @@ async function createDebugRunFileConfigs(
         tdmlConfig.action = tdmlAction
 
         if (tdmlAction === 'execute') {
-          tdmlConfig.path = targetResource.fsPath.toString()
+          tdmlConfig.path = targetResource.fsPath
 
           tdmlConfig.name =
             tdmlConfig.name ||
@@ -177,17 +183,7 @@ async function createDebugRunFileConfigs(
               tdmlConfig.path
             ))
 
-          tdmlConfig.description =
-            tdmlConfig.description ||
-            (await vscode.commands.executeCommand(
-              'extension.dfdl-debug.getTDMLDescription',
-              tdmlConfig.path
-            ))
-
-          if (!tdmlConfig.name || !tdmlConfig.description) {
-            vscode.window.showInformationMessage(
-              'ESC pressed on a TDML Test Case selection picker! Stopping 
debugging.'
-            )
+          if (!tdmlConfig.name) {
             return
           }
         }
@@ -417,14 +413,13 @@ export function activateDaffodilDebug(
     vscode.commands.registerCommand(
       'extension.dfdl-debug.getTDMLName',
       async (tdmlConfigPath) => {
-        // Config item gets passed
-
         // get test case name options for dropdown
         const test_case_names: string[] = getTDMLTestCaseItems(tdmlConfigPath)
-          .filter((obj) => typeof obj.name == 'string')
-          .map((obj) => obj.name) as string[]
 
         if (test_case_names.length == 0) {
+          vscode.window.showInformationMessage(
+            'No test cases found in TDML file.'
+          )
           return
         }
 
@@ -436,36 +431,6 @@ export function activateDaffodilDebug(
     )
   )
 
-  context.subscriptions.push(
-    vscode.commands.registerCommand(
-      'extension.dfdl-debug.getTDMLDescription',
-      async (tdmlConfigPath) => {
-        // Config item gets passed
-
-        // get unique test case description options for dropdown as it may be 
possible for overlapping description
-        const test_case_unique_descriptions: string[] = [
-          ...new Set(
-            getTDMLTestCaseItems(tdmlConfigPath)
-              .filter((obj) => typeof obj.description == 'string')
-              .map((obj) => obj.description)
-          ),
-        ] as string[]
-
-        if (test_case_unique_descriptions.length == 0) {
-          return
-        }
-
-        // Await showQuickPick directly and return the result
-        return await vscode.window.showQuickPick(
-          test_case_unique_descriptions,
-          {
-            placeHolder: 'Test Case Description',
-          }
-        )
-      }
-    )
-  )
-
   context.subscriptions.push(
     vscode.commands.registerCommand(
       'extension.dfdl-debug.getTDMLPath',
diff --git a/src/classes/tdmlConfig.ts b/src/classes/tdmlConfig.ts
index 5b75e57..3ee556d 100644
--- a/src/classes/tdmlConfig.ts
+++ b/src/classes/tdmlConfig.ts
@@ -18,6 +18,5 @@
 export interface TDMLConfig {
   action: string
   name?: string
-  description?: string
   path?: string
 }
diff --git a/src/daffodilDebugger/debugger.ts b/src/daffodilDebugger/debugger.ts
index 580d63b..7fd9d39 100644
--- a/src/daffodilDebugger/debugger.ts
+++ b/src/daffodilDebugger/debugger.ts
@@ -21,7 +21,6 @@ import * as path from 'path'
 import { getConfig } from '../utils'
 import { runDebugger, stopDebugger, stopDebugging } from './utils'
 import {
-  getDefaultTDMLTestCaseDescription,
   getDefaultTDMLTestCaseName,
   getTmpTDMLFilePath,
 } from '../tdmlEditor/utilities/tdmlXmlUtils'
@@ -70,12 +69,6 @@ async function getTDMLConfig(
         'extension.dfdl-debug.getTDMLName',
         config?.tdmlConfig?.path
       )
-
-    if (config?.tdmlConfig?.description === undefined)
-      config.tdmlConfig.description = await vscode.commands.executeCommand(
-        'extension.dfdl-debug.getTDMLDescription',
-        config?.tdmlConfig?.path
-      )
   }
 
   if (config?.tdmlConfig?.action === 'generate') {
@@ -86,13 +79,6 @@ async function getTDMLConfig(
     )
       config.tdmlConfig.name = getDefaultTDMLTestCaseName()
 
-    if (
-      config?.tdmlConfig?.description === undefined ||
-      config?.tdmlConfig?.description === 'undefined' ||
-      config?.tdmlConfig?.description === ''
-    )
-      config.tdmlConfig.description = getDefaultTDMLTestCaseDescription()
-
     if (
       config?.tdmlConfig?.path === undefined ||
       config?.tdmlConfig?.path === 'undefined' ||
diff --git a/src/launchWizard/launchWizard.ts b/src/launchWizard/launchWizard.ts
index db2815f..3d6e285 100644
--- a/src/launchWizard/launchWizard.ts
+++ b/src/launchWizard/launchWizard.ts
@@ -503,10 +503,6 @@ class LaunchWizard {
       'tdmlConfig' in defaultValues && defaultValues.tdmlConfig['name']
         ? defaultValues.tdmlConfig['name']
         : ''
-    let tdmlDescription =
-      'tdmlConfig' in defaultValues && defaultValues.tdmlConfig['description']
-        ? defaultValues.tdmlConfig['description']
-        : ''
     let tdmlPath =
       'tdmlConfig' in defaultValues && defaultValues.tdmlConfig['path']
         ? defaultValues.tdmlConfig['path']
@@ -741,9 +737,6 @@ class LaunchWizard {
         <p id="tdmlNameLabel" style="${tdmlNameDesVisOrHiddenStyle}" 
class="setting-description">TDML Name:</p>
         <input style="${tdmlNameDesVisOrHiddenStyle}" class="file-input" 
value="${tdmlName}" id="tdmlName">
 
-        <p id="tdmlDescriptionLabel" style="${tdmlNameDesVisOrHiddenStyle}" 
class="setting-description">TDML Description:</p>
-        <input style="${tdmlNameDesVisOrHiddenStyle}" class="file-input" 
value="${tdmlDescription}" id="tdmlDescription">
-
         <p id="tdmlPathLabel" style="${tdmlPathVisOrHiddenStyle}" 
class="setting-description">TDML File Path:</p>
         <input style="${tdmlPathVisOrHiddenStyle}" class="file-input" 
value="${tdmlPath}" id="tdmlPath">
       </div>
diff --git a/src/launchWizard/script.js b/src/launchWizard/script.js
index 1a4bd78..7ec75b4 100644
--- a/src/launchWizard/script.js
+++ b/src/launchWizard/script.js
@@ -57,7 +57,6 @@ function getConfigValues() {
   const infosetOutputType = document.getElementById('infosetOutputType').value
   const tdmlAction = document.getElementById('tdmlAction').value
   const tdmlName = document.getElementById('tdmlName').value
-  const tdmlDescription = document.getElementById('tdmlDescription').value
   const tdmlPath = document.getElementById('tdmlPath').value
   const openDataEditor = document.getElementById('openDataEditor').checked
   const openInfosetDiffView = document.getElementById(
@@ -99,7 +98,6 @@ function getConfigValues() {
     infosetOutputType,
     tdmlAction,
     tdmlName,
-    tdmlDescription,
     tdmlPath,
     openDataEditor,
     openInfosetDiffView,
@@ -221,19 +219,11 @@ function updateTDMLAction() {
       'margin-top: 10px; visibility: visible;'
     document.getElementById('tdmlName').style =
       'margin-top: 10px; visibility: visible;'
-    document.getElementById('tdmlDescriptionLabel').style =
-      'margin-top: 10px; visibility: visible;'
-    document.getElementById('tdmlDescription').style =
-      'margin-top: 10px; visibility: visible;'
   } else {
     document.getElementById('tdmlNameLabel').style =
       'width: 0px; height: 0px; visibility: hidden;'
     document.getElementById('tdmlName').style =
       'width: 0px; height: 0px; visibility: hidden;'
-    document.getElementById('tdmlDescriptionLabel').style =
-      'width: 0px; height: 0px; visibility: hidden;'
-    document.getElementById('tdmlDescription').style =
-      'width: 0px; height: 0px; visibility: hidden;'
   }
 
   if (tdmlSelectedValue === 'generate') {
@@ -328,8 +318,6 @@ function save() {
       obj.configurations[0].tdmlConfig.path = configValues.tdmlPath
     case 'execute':
       obj.configurations[0].tdmlConfig.name = configValues.tdmlName
-      obj.configurations[0].tdmlConfig.description =
-        configValues.tdmlDescription
       break
     default:
       throw new Error(
@@ -370,7 +358,6 @@ function copyConfig() {
         tdmlConfig: {
           action: configValues.tdmlAction,
           name: configValues.tdmlName,
-          description: configValues.tdmlDescription,
           path: configValues.tdmlPath,
         },
         trace: configValues.trace,
@@ -431,10 +418,6 @@ async function updateConfigValues(config) {
     config['tdmlConfig'] && config.tdmlConfig['name']
       ? config.tdmlConfig['name']
       : config.tdmlName
-  document.getElementById('tdmlDescription').value =
-    config['tdmlConfig'] && config.tdmlConfig['description']
-      ? config.tdmlConfig['description']
-      : config.tdmlDescription
   document.getElementById('tdmlPath').value =
     config['tdmlConfig'] && config.tdmlConfig['path']
       ? config.tdmlConfig['path']
diff --git a/src/tdmlEditor/TDMLProvider.ts b/src/tdmlEditor/TDMLProvider.ts
index e2a91fb..e87ddf3 100644
--- a/src/tdmlEditor/TDMLProvider.ts
+++ b/src/tdmlEditor/TDMLProvider.ts
@@ -33,9 +33,14 @@ export class TDMLProvider implements 
vscode.CustomTextEditorProvider {
     return providerRegistration
   }
 
+  public static getDocumentUri(): vscode.Uri | undefined {
+    return TDMLProvider.currentUri
+  }
+
   private static readonly viewType = AppConstants.viewTypeId
   private registered = false
   private currentPanel: vscode.WebviewPanel | undefined = undefined
+  private static currentUri: vscode.Uri | undefined = undefined
 
   constructor(private readonly context: vscode.ExtensionContext) {}
 
@@ -58,8 +63,20 @@ export class TDMLProvider implements 
vscode.CustomTextEditorProvider {
     webviewPanel.webview.html = this._getWebviewContent(webviewPanel.webview)
     webviewPanel.onDidChangeViewState((e) => {
       this.currentPanel = e.webviewPanel
+
+      if (e.webviewPanel.active) {
+        TDMLProvider.currentUri = document.uri
+      } else if (
+        TDMLProvider.currentUri?.toString() === document.uri.toString()
+      ) {
+        TDMLProvider.currentUri = undefined
+      }
     })
 
+    if (webviewPanel.active) {
+      TDMLProvider.currentUri = document.uri
+    }
+
     try {
       printChannelOutput(document.uri.toString(), true)
       if (!this.registered) {
@@ -128,6 +145,10 @@ export class TDMLProvider implements 
vscode.CustomTextEditorProvider {
 
     webviewPanel.onDidDispose(() => {
       changeDocumentSubscription.dispose()
+
+      if (TDMLProvider.currentUri?.toString() === document.uri.toString()) {
+        TDMLProvider.currentUri = undefined
+      }
     })
 
     webviewPanel.webview.onDidReceiveMessage((e) => {
diff --git a/src/tdmlEditor/utilities/tdmlXmlUtils.ts 
b/src/tdmlEditor/utilities/tdmlXmlUtils.ts
index 5dedd35..cc2ea5a 100644
--- a/src/tdmlEditor/utilities/tdmlXmlUtils.ts
+++ b/src/tdmlEditor/utilities/tdmlXmlUtils.ts
@@ -82,10 +82,6 @@ export function getDefaultTDMLTestCaseName() {
   return 'Default Test Case'
 }
 
-export function getDefaultTDMLTestCaseDescription() {
-  return 'Generated by DFDL VSCode Extension'
-}
-
 /*
  * Read the XML contents of a TDML file
  *
diff --git a/src/tests/suite/utils.test.ts b/src/tests/suite/utils.test.ts
index 43f51cf..1e6e45d 100644
--- a/src/tests/suite/utils.test.ts
+++ b/src/tests/suite/utils.test.ts
@@ -44,7 +44,6 @@ suite('Utils Test Suite', () => {
     tdmlConfig: {
       action: 'generate',
       name: 'Default Test Case',
-      description: 'Generated by DFDL VSCode Extension',
       path: getTmpTDMLFilePath(),
     },
     stopOnEntry: true,
diff --git a/src/utils.ts b/src/utils.ts
index b7ed285..15068f1 100644
--- a/src/utils.ts
+++ b/src/utils.ts
@@ -139,7 +139,6 @@ export function getConfig(jsonArgs: object): 
vscode.DebugConfiguration {
       ...{
         action: 'generate',
         name: 'Default Test Case',
-        description: 'Generated by DFDL VSCode Extension',
         path: getTmpTDMLFilePath(),
       },
       ...((defaultConf.get('tdmlConfig') as object) || {}),
@@ -418,14 +417,9 @@ export function substituteVSCodeEnvVariables(
  * Retrieves an array of test case items from a TDML (Test Data Markup 
Language) file.
  *
  * @param path - The file path to the TDML file.
- * @returns An array of objects representing the test cases, where each object 
contains:
- *          - `name`: The name of the test case (or undefined if not present).
- *          - `description`: The description of the test case (or undefined if 
not present).
- *          Returns an empty array if the file does not exist or if no test 
cases are found.
+ * @returns An array of test case names
  */
-export function getTDMLTestCaseItems(
-  path: string
-): { name: string | undefined; description: string | undefined }[] {
+export function getTDMLTestCaseItems(path: string): string[] {
   if (!fs.existsSync(path)) {
     return [] // TDML file not found
   }
@@ -441,27 +435,13 @@ export function getTDMLTestCaseItems(
   const xml_obj = parser.parse(fileData)
 
   // Read through TDML test cases and populate each TDML test case item if XML 
file is valid enough
-  if (
-    // Otherwise, it's an array
-    Array.isArray(xml_obj['testSuite']?.['parserTestCase'])
-  ) {
-    return xml_obj['testSuite']['parserTestCase'].map((obj) => ({
-      name: obj['@_name'],
-      description: obj['@_description'],
-    }))
-  } else if (
-    // One item results in an object type
-    xml_obj['testSuite']?.['parserTestCase'] &&
-    typeof xml_obj['testSuite']?.['parserTestCase'] == 'object'
-  ) {
-    const obj = xml_obj['testSuite']?.['parserTestCase']
-    return [
-      {
-        name: obj['@_name'],
-        description: obj['@_description'],
-      },
-    ]
-  } else {
-    return []
-  }
+  // parserTestCaseObjs can be either an array of objects, a single object, or 
undefined if no parserTestCase element was found
+  // Convert that into an array and return a list containing the names of each 
parserTestCase element
+  const parserTestCaseObjs = xml_obj['testSuite']?.['parserTestCase']
+  const testCaseArr = Array.isArray(parserTestCaseObjs)
+    ? parserTestCaseObjs
+    : parserTestCaseObjs
+      ? [parserTestCaseObjs]
+      : []
+  return testCaseArr.map((item) => item['@_name'])
 }


Reply via email to