apache / daffodil-vscode

Apache Daffodil™ Extension for Visual Studio Code
https://daffodil.apache.org/
Apache License 2.0
11 stars 19 forks source link

Fix broken TDML append, copy and execute functionality #1022

Closed hdalsania closed 4 months ago

hdalsania commented 5 months ago

closes #1013

Fixed TDML functionality. Now copyTDML, Append and Execute TDML works as expected.

Following functionality still need re-visit and further enhancement issues needs to be created.

Steps to test TDML copy, execute, append

Configure launch.json to generate a TDML file. image

Run the debug extension, choose a dfdl schema and data file. After the schema opens make sure the language mode is DFDL. image

Press the continue button to produce the infoset. image

When the infoset generates, a temporary TDML schema will generate. image

Close any open window except the dfdl schema window. Click “Copy TDML File” in the dropdown at the top tight of the editor window. image

Enter a name for the TDML file, click “Save TDML File in the lower right corner of the popup. image

Close the dfdl schema in the editor window. Click on the explore tab in the top left corner to display the file view. Click on the save TDML file. image

After the TDML file opens click the menu in the top right corner and select “Execute TDML” image

Quickly select a test case a press enter. Then quickly accept the description and press enter. image

The previously selected dfdl schema will open and the previously selected data file will be used and empty infoset will also open. image

To append to the existing TDML file, open the test file and click the button in the upper right corner to open in a text editor. image

Change the test case name and save the file. image

Select append from the TDML dropdown menu at the upper right. image

The original default test case will be appended to saved TDML file with the new test case. image

stricklandrbls commented 4 months ago

M1 Macbook Testing

Testing this on my M1 macbook resulted in no generatedTDML file in any temporary directory.

Pop!OS (Ubuntu 22.04) Testing

The generated file is created successfully and I can run the Copy, Append, and Execute operations. Though when executing there is an uninformative info dialog message that pops up that only contains the string of the infoset file name:

image

Edit: It looks like this is an artifact from some really old code: https://github.com/hdalsania/daffodil-vscode/blob/6bc5f4135a45dbccc2679cfa846b0d34f24aca9d/src/adapter/activateDaffodilDebug.ts#L145

scholarsmate commented 4 months ago

Didn't want to merge this yet until @stricklandrbls approves.

stricklandrbls commented 4 months ago

M1 Macbook Pro Test Failure

@hdalsania @scholarsmate @shanedell - I just tested this again on my M1 Macbook Pro and I still cannot Copy / Append because the generated tmp file is not created.

The Copy TDML File button exists but will not save the .tdml file anywhere once the data debugger is finished and I attempt to save.

VSCode Debug Output

simulatorDirPath: undefined
deviceFilePath: undefined
simulatorDirPath: undefined
deviceFilePath: undefined
detected java homes: [{"path":"/Library/Java/JavaVirtualMachines/jdk-11.0.16.1.jdk/Contents/Home","version":"11.0.16","security":0,"isJDK":true,"is64Bit":true,"executables":{"java":"/Library/Java/JavaVirtualMachines/jdk-11.0.16.1.jdk/Contents/Home/bin/java","javac":"/Library/Java/JavaVirtualMachines/jdk-11.0.16.1.jdk/Contents/Home/bin/javac","javap":"/Library/Java/JavaVirtualMachines/jdk-11.0.16.1.jdk/Contents/Home/bin/javap"}},{"path":"/Library/Java/JavaVirtualMachines/microsoft-11.jdk/Contents/Home","version":"11.0.16","security":0,"isJDK":true,"is64Bit":true,"executables":{"java":"/Library/Java/JavaVirtualMachines/microsoft-11.jdk/Contents/Home/bin/java","javac":"/Library/Java/JavaVirtualMachines/microsoft-11.jdk/Contents/Home/bin/javac","javap":"/Library/Java/JavaVirtualMachines/microsoft-11.jdk/Contents/Home/bin/javap"}},{"path":"/Library/Java/JavaVirtualMachines/temurin-8.jdk/Contents/Home","version":"1.8.0","security":302,"isJDK":true,"is64Bit":true,"executables":{"java":"/Library/Java/JavaVirtualMachines/temurin-8.jdk/Contents/Home/bin/java","javac":"/Library/Java/JavaVirtualMachines/temurin-8.jdk/Contents/Home/bin/javac","javap":"/Library/Java/JavaVirtualMachines/temurin-8.jdk/Contents/Home/bin/javap"}}]
choosing java home at /Library/Java/JavaVirtualMachines/jdk-11.0.16.1.jdk/Contents/Home, version 11.0.16, is at least JDK 17: false
No test suite found in source XML buffer

The output line: No test suite found in source XML buffer gets outputted every time I attempt to save the generate .tdml file via Copy TDML File.

shanedell commented 4 months ago

@hdalsania @stricklandrbls I also get a No test suite found in source XML buffer when I try to Copy TDML File or when I try to Append TDML.

stricklandrbls commented 4 months ago

@hdalsania @scholarsmate @shanedell I did a little digging and running the extension in debug mode w/ breakpoints. It looks like this is coming from this scope of code:

https://github.com/apache/daffodil-vscode/blob/5bd426e1dbdf25b40193ba0a2eb17dbc9d861ba1/src/tdmlEditor/utilities/tdmlXmlUtils.ts#L277-L295

I think it has something to do with this function being async but not returning a Promise because this block of code throws with all of the scoped variables being undefined or uninitialized.

hdalsania commented 4 months ago

We created a bug issue #1035 to address MacOS platform and changed the scope of this PR to be limited to Windows/Linux platform.