You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@daffodil.apache.org by sh...@apache.org on 2023/06/13 13:24:22 UTC

[daffodil-vscode] branch main updated: Fix issue with launch wizard parsing

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 ad289dc  Fix issue with launch wizard parsing
ad289dc is described below

commit ad289dc02237bce2642b17c7448b1ae1b5e318ff
Author: Shane Dell <sh...@gmail.com>
AuthorDate: Mon Jun 12 12:36:07 2023 -0400

    Fix issue with launch wizard parsing
    
    - Update launch wizard to parse the daffodilDebuggerClasspathTable items textContent instead of innerHTML.
      - Using innerHTML was causing an issue where the wizard would set the classpath as the css class name "debug-classpath-item" instead of its actual value.
    - Update launch wizard to not add empty strings to daffodilDebuggerClasspathTable.
      - An empty string can happens from the user closing the file picker, in which case we don't want to add it to the table.
---
 src/launchWizard/launchWizard.js | 22 +++++++++++++++-------
 src/launchWizard/launchWizard.ts | 12 ++++++++----
 2 files changed, 23 insertions(+), 11 deletions(-)

diff --git a/src/launchWizard/launchWizard.js b/src/launchWizard/launchWizard.js
index 015e314..a3600f4 100644
--- a/src/launchWizard/launchWizard.js
+++ b/src/launchWizard/launchWizard.js
@@ -182,13 +182,21 @@ function save() {
 
   let daffodilDebugClasspath = ''
 
-  for (var i = 0; i < list.childNodes.length; i++) {
-    let item = list.childNodes[i]
-    let classpath = item.innerHTML.split('"')[3]
+  list.childNodes.forEach((childNode) => {
+    let classpath = childNode.textContent
+      .replaceAll(' ', '') // remove any un-needed whitespace
+      .replace('-', '') // remove initial - in front of every item
+      .split('\n')
+      .filter((cp) => cp != '')
+      .join(':')
 
-    daffodilDebugClasspath +=
-      i === list.childNodes.length - 1 ? classpath : classpath + ':'
-  }
+    if (classpath != '') {
+      daffodilDebugClasspath +=
+        childNode === list.childNodes[list.childNodes.length - 1]
+          ? classpath
+          : classpath + ':'
+    }
+  })
 
   var obj = {
     version: '0.2.0',
@@ -218,7 +226,7 @@ function save() {
         openInfosetView: openInfosetView,
         openInfosetDiffView: openInfosetDiffView,
         daffodilDebugClasspath: daffodilDebugClasspath,
-        dataEditorConfig: {
+        dataEditor: {
           port: dataEditorPort,
           logFile: dataEditorLogFile,
           logLevel: dataEditorLogLevel,
diff --git a/src/launchWizard/launchWizard.ts b/src/launchWizard/launchWizard.ts
index 13d48d9..d224a30 100644
--- a/src/launchWizard/launchWizard.ts
+++ b/src/launchWizard/launchWizard.ts
@@ -199,10 +199,14 @@ async function createWizard(ctx: vscode.ExtensionContext) {
           return
         case 'openFilePicker':
           let result = await openFilePicker(message.description)
-          panel.webview.postMessage({
-            command: `${message.id}Update`,
-            value: result,
-          })
+
+          // don't add empty string to table
+          if (result !== '') {
+            panel.webview.postMessage({
+              command: `${message.id}Update`,
+              value: result,
+            })
+          }
           return
       }
     },