This is an automated email from the ASF dual-hosted git repository.
hdalsania 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 7c999862 Adding tunables to wizard. If this is acceptable will add
variables in the same manner
7c999862 is described below
commit 7c999862ea1a7852d3b8bddf5fd4b3366db3ba69
Author: Adedoyin Ogunjobi <[email protected]>
AuthorDate: Thu Apr 30 08:38:48 2026 -0400
Adding tunables to wizard. If this is acceptable will add variables in the
same manner
adding variables
Bump fast-xml-parser from 5.5.9 to 5.7.2
Bumps
[fast-xml-parser](https://github.com/NaturalIntelligence/fast-xml-parser) from
5.5.9 to 5.7.2.
- [Release
notes](https://github.com/NaturalIntelligence/fast-xml-parser/releases)
-
[Changelog](https://github.com/NaturalIntelligence/fast-xml-parser/blob/master/CHANGELOG.md)
-
[Commits](https://github.com/NaturalIntelligence/fast-xml-parser/compare/v5.5.9...v5.7.2)
---
updated-dependencies:
- dependency-name: fast-xml-parser
dependency-version: 5.7.2
dependency-type: direct:development
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <[email protected]>
Bump @vscode/vsce from 3.7.1 to 3.9.1
Bumps [@vscode/vsce](https://github.com/Microsoft/vsce) from 3.7.1 to 3.9.1.
- [Release notes](https://github.com/Microsoft/vsce/releases)
- [Commits](https://github.com/Microsoft/vsce/compare/v3.7.1...v3.9.1)
---
updated-dependencies:
- dependency-name: "@vscode/vsce"
dependency-version: 3.9.1
dependency-type: direct:development
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <[email protected]>
Bump actions/setup-node from 6.3.0 to 6.4.0
Bumps [actions/setup-node](https://github.com/actions/setup-node) from
6.3.0 to 6.4.0.
- [Release notes](https://github.com/actions/setup-node/releases)
-
[Commits](https://github.com/actions/setup-node/compare/53b83947a5a98c8d113130e565377fae1a50d02f...48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e)
---
updated-dependencies:
- dependency-name: actions/setup-node
dependency-version: 6.4.0
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <[email protected]>
Bump actions/github-script from 8.0.0 to 9.0.0
Bumps [actions/github-script](https://github.com/actions/github-script)
from 8.0.0 to 9.0.0.
- [Release notes](https://github.com/actions/github-script/releases)
-
[Commits](https://github.com/actions/github-script/compare/ed597411d8f924073f98dfc5c65a23a2325f34cd...3a2844b7e9c422d3c10d287c895573f7108da1b3)
---
updated-dependencies:
- dependency-name: actions/github-script
dependency-version: 9.0.0
dependency-type: direct:production
update-type: version-update:semver-major
...
Signed-off-by: dependabot[bot] <[email protected]>
Changed wording in CI to match PR template
Documentation Variable and Tunable Configuration
Added sections on Variable and Tunable Configuration with usage
instructions and references.
Fix copy mechanism
Co-authored-by: Copilot Autofix powered by AI
<[email protected]>
copilot recommendations
copilot recommendations
copilot recs. Last one
Fix rootName/rootNamespace null handling in launch config
the default value should be null not string null
if user inputs spaces, treat it as null still
update docs on root elements and fix pipeline
Replace image with updated HTML tag for clarity
Updated image tag for Root and RootNameSpace Element section.
---
.github/workflows/documentaion.yml | 2 +-
doc/Introduction-to-Daffodil-VS-Code-Extension.md | 3 +-
doc/Wiki.md | 31 +++++
src/classes/vscode-launch.ts | 2 +
src/launchWizard/launchWizard.ts | 48 +++++++-
src/launchWizard/script.js | 143 +++++++++++++++++++++-
6 files changed, 221 insertions(+), 8 deletions(-)
diff --git a/.github/workflows/documentaion.yml
b/.github/workflows/documentaion.yml
index 7b29c9e3..fc78c0da 100644
--- a/.github/workflows/documentaion.yml
+++ b/.github/workflows/documentaion.yml
@@ -35,7 +35,7 @@ jobs:
const prBody = context.payload.pull_request?.body || "";
const checkbox1Text = "- [x] I have determined that no
documentation updates are needed for these changes";
const checkbox2Text = "- [x] I have added the following
documentation for these changes";
-
+
if (!prBody.includes(checkbox1Text) &&
!prBody.includes(checkbox2Text)) {
core.setFailed("❌ Required documentation checkbox not checked.
Please check one of the boxes before merging.");
} else {
diff --git a/doc/Introduction-to-Daffodil-VS-Code-Extension.md
b/doc/Introduction-to-Daffodil-VS-Code-Extension.md
index a36dd42d..32b6adcf 100644
--- a/doc/Introduction-to-Daffodil-VS-Code-Extension.md
+++ b/doc/Introduction-to-Daffodil-VS-Code-Extension.md
@@ -136,7 +136,8 @@ Leave the
`${command:AskForSchemaName}`/`${command:AskForDataName}` values and y
|<div style="width:200px"></div>|<div style="width:205px"></div>|
|:---|:---|
|***Configuring for First Use***<br>*Launch Config Wizard*||
-|*Root Element*<br>For simple schemas, this field may be left set to
`undefined` ||
+|*Root and RootNameSpace Element*<br>For simple schemas, this field should be
left empty. Unless specified no string should be in either field, so that they
can default to null value not string. |<img width="519" height="240"
alt="image"
src="https://github.com/user-attachments/assets/5d395a41-1592-4f1c-ac24-c66165198f99"
/>
+|
diff --git a/doc/Wiki.md b/doc/Wiki.md
index b21fe54a..2d56f7c3 100644
--- a/doc/Wiki.md
+++ b/doc/Wiki.md
@@ -350,6 +350,37 @@ Referenced Links:
* https://sematext.com/blog/logging-levels/
*
https://www.crowdstrike.com/en-us/cybersecurity-101/next-gen-siem/logging-levels/
+## Variable Configuration
+
+Variables are configured using **Key** and **Value** fields in the launch
configuration wizard.
+
+- **Key**: The variable name
+- **Value**: The value assigned to the variable
+
+Use the **“+ Add Variable”** button to add additional entries. Each row can be
removed using the **“X”** button.
+
+<img width="790" height="186" alt="variables_gui"
src="https://github.com/user-attachments/assets/0bd03842-4fe9-41e9-985b-272c0a80e48d"
/>
+
+<img width="470" height="152" alt="variables_launchjson"
src="https://github.com/user-attachments/assets/09ce477c-1026-4d6c-9922-a31459e7b0e1"
/>
+
+## Tunable Configuration
+
+Tunables are configured using **Key** and **Value** fields in the launch
configuration wizard.
+
+- **Key**: The tunable name
+- **Value**: The value assigned to the tunable
+
+Use the **“+ Add Tunable”** button to add additional entries. Each row can be
removed using the **“X”** button.
+
+Tunables control runtime behavior and performance characteristics. Most
tunables have default values, so you only need to specify a value if you want
to override them.
+
+<img width="790" height="176" alt="tunables_gui"
src="https://github.com/user-attachments/assets/f78d5471-bfff-4cfb-b6cf-62c787a8e31b"
/>
+
+<img width="360" height="177" alt="tunables_launchjson"
src="https://github.com/user-attachments/assets/0d70044d-d04c-4f47-958c-175c6e67f3f9"
/>
+
+### Reference
+- https://daffodil.apache.org/tunables/
+
## Root element and namespace auto suggestions/finding
In the launch.json file, there's a new suggestion mode that gives you
suggestions to fill in for the rootname. If you specify the specific schema
path, and then save the file, and reopen it. Go to rootname and delete whatever
value is set-- it will show you various suggestions.
diff --git a/src/classes/vscode-launch.ts b/src/classes/vscode-launch.ts
index e53e7fd3..5f8a1d0f 100644
--- a/src/classes/vscode-launch.ts
+++ b/src/classes/vscode-launch.ts
@@ -35,6 +35,8 @@ export interface VSCodeLaunchConfigArgs {
stopOnEntry: boolean
useExistingServer: boolean
trace: boolean
+ tunables?: Record<string, string>
+ variables?: Record<string, string>
openDataEditor: boolean
openInfosetView: boolean
openInfosetDiffView: boolean
diff --git a/src/launchWizard/launchWizard.ts b/src/launchWizard/launchWizard.ts
index 4ca67530..c130a8fe 100644
--- a/src/launchWizard/launchWizard.ts
+++ b/src/launchWizard/launchWizard.ts
@@ -31,8 +31,8 @@ const defaultConf = getConfig({
type: 'dfdl',
schema: {
path: '${command:AskForSchemaName}',
- rootName: 'null',
- rootNamespace: 'null',
+ rootName: null,
+ rootNamespace: null,
},
})
@@ -754,7 +754,50 @@ class LaunchWizard {
<p id="tdmlPathLabel" style="${tdmlPathVisOrHiddenStyle}"
class="setting-description">TDML File Path:</p>
<input style="${tdmlPathVisOrHiddenStyle}" class="file-input"
value="${tdmlPath}" id="tdmlPath">
</div>
+
+ <div id="tunablesDiv" class="setting-div" style="margin-top: 15px;">
+ <p>Tunables:</p>
+ <p class="setting-description">Key/value configuration options</p>
+
+ <table style="width: 100%; border-collapse: collapse; margin-top:
5px;">
+ <thead>
+ <tr>
+ <th style="text-align: left;">Key</th>
+ <th style="text-align: left;">Value</th>
+ <th></th>
+ </tr>
+ </thead>
+ <tbody id="tunablesTableBody">
+ <!-- rows later -->
+ </tbody>
+ </table>
+
+ <button id="addTunableBtn" onclick="addTunableRow()"
style="margin-top: 10px;">
+ + Add Tunable
+ </button>
+ </div>
+ <div id="VariablesDiv" class="setting-div" style="margin-top: 15px;">
+ <p>Variables:</p>
+ <p class="setting-description">Key/value configuration options</p>
+
+ <table style="width: 100%; border-collapse: collapse; margin-top:
5px;">
+ <thead>
+ <tr>
+ <th style="text-align: left;">Key</th>
+ <th style="text-align: left;">Value</th>
+ <th></th>
+ </tr>
+ </thead>
+ <tbody id="variablesTableBody">
+ <!-- rows later -->
+ </tbody>
+ </table>
+
+ <button id="addVariableBtn" onclick="addVariableRow()"
style="margin-top: 10px;">
+ + Add Variable
+ </button>
+ </div>
<div id="dataEditorDiv" class="setting-div">
<p>Data Editor Settings:</p>
@@ -769,7 +812,6 @@ class LaunchWizard {
${dataEditorLogLevelSelect}
</select>
</div>
-
<br/>
<button class="save-button" type="button" onclick="save()">Save</button>
</body>
diff --git a/src/launchWizard/script.js b/src/launchWizard/script.js
index c7356db5..63811c55 100644
--- a/src/launchWizard/script.js
+++ b/src/launchWizard/script.js
@@ -41,6 +41,8 @@ function getConfigIndex() {
}
function getConfigValues() {
+ const tunables = getTunablesFromTable()
+ const variables = getVariablesFromTable()
var configSelectionBox = document.getElementById('configSelected')
var configSelectedValue =
configSelectionBox.options[configSelectionBox.selectedIndex].value
@@ -85,16 +87,16 @@ function getConfigValues() {
'dfdlDebuggerLogLevel'
).value
const rootName =
- document.getElementById('rootName').value == 'null'
+ document.getElementById('rootName').value.trim() === ''
? null
: document.getElementById('rootName').value
+
const rootNamespace =
- document.getElementById('rootNamespace').value == 'null'
+ document.getElementById('rootNamespace').value.trim() === ''
? null
: document.getElementById('rootNamespace').value
const daffodilDebugClasspath = getDaffodilDebugClasspathArray()
-
return {
name,
data,
@@ -122,6 +124,8 @@ function getConfigValues() {
daffodilDebugClasspath,
rootName,
rootNamespace,
+ tunables,
+ variables,
}
}
@@ -275,6 +279,8 @@ function save() {
configSelectedValue === 'New Config' ? 'create' : 'update'
const configValues = getConfigValues()
+ const tunables = getTunablesFromTable()
+ const variables = getVariablesFromTable()
var obj = {
version: '0.2.0',
@@ -295,6 +301,8 @@ function save() {
type: configValues.infosetOutputType,
path: configValues.infosetOutputFilePath,
},
+ tunables: tunables,
+ variables: variables,
tdmlConfig: {
action: configValues.tdmlAction,
// Additional fields are added below
@@ -346,6 +354,115 @@ function save() {
updateOrCreate: updateOrCreate,
})
}
+// Function for adding row to tunables table
+function addTunableRow() {
+ const tableBody = document.getElementById('tunablesTableBody')
+
+ const row = document.createElement('tr')
+
+ row.innerHTML = `
+ <td><input class="file-input" /></td>
+ <td><input class="file-input" /></td>
+ <td><button onclick="this.closest('tr').remove()">X</button></td>
+ `
+
+ tableBody.appendChild(row)
+}
+
+function getTunablesFromTable() {
+ const rows = document.querySelectorAll('#tunablesTableBody tr')
+ const tunables = {}
+
+ rows.forEach((row) => {
+ const key = row.children[0].querySelector('input')?.value?.trim()
+ const value = row.children[1].querySelector('input')?.value
+
+ if (!key) return
+
+ tunables[key] = value
+ })
+
+ return tunables
+}
+
+function escapeHtml(str) {
+ return String(str)
+ .replace(/&/g, '&')
+ .replace(/</g, '<')
+ .replace(/>/g, '>')
+ .replace(/"/g, '"')
+ .replace(/'/g, ''')
+}
+
+// function to pull tunables from config and render them in the tunables
table, if there are any
+function renderTunables(tunables = {}) {
+ const tableBody = document.getElementById('tunablesTableBody')
+ tableBody.innerHTML = ''
+
+ Object.entries(tunables).forEach(([key, value]) => {
+ const row = document.createElement('tr')
+
+ row.innerHTML = `
+ <td><input class="file-input" value="${escapeHtml(key)}" /></td>
+ <td><input class="file-input" value="${escapeHtml(value)}" /></td>
+ <td><button onclick="this.closest('tr').remove()">X</button></td>
+ `
+
+ tableBody.appendChild(row)
+ })
+}
+
+// Function for adding row to variables table
+function addVariableRow() {
+ const tableBody = document.getElementById('variablesTableBody')
+
+ const row = document.createElement('tr')
+
+ row.innerHTML = `
+ <td><input class="file-input" /></td>
+ <td><input class="file-input" /></td>
+ <td><button onclick="this.closest('tr').remove()">X</button></td>
+ `
+
+ tableBody.appendChild(row)
+}
+
+function getVariablesFromTable() {
+ const rows = document.querySelectorAll('#variablesTableBody tr')
+ const variables = {}
+
+ rows.forEach((row) => {
+ const key = row.children[0].querySelector('input')?.value?.trim()
+ const value = row.children[1].querySelector('input')?.value
+
+ if (!key) return
+
+ variables[key] = value
+ })
+
+ return variables
+}
+
+// function to pull variables from config and render them in the tunables
table, if there are any.
+
+function renderVariables(variables = {}) {
+ const tableBody = document.getElementById('variablesTableBody')
+
+ // Clear existing UI
+ tableBody.innerHTML = ''
+
+ Object.entries(variables).forEach(([key, value]) => {
+ const row = document.createElement('tr')
+
+ row.innerHTML = `
+ <td><input class="file-input" value="${escapeHtml(key)}" /></td>
+ <td><input class="file-input" value="${escapeHtml(value)}" /></td>
+ <td><button onclick="this.closest('tr').remove()">X</button></td>
+ `
+
+ tableBody.appendChild(row)
+ })
+}
// Function to copy selected config
function copyConfig() {
@@ -370,6 +487,8 @@ function copyConfig() {
type: configValues.infosetOutputType,
path: configValues.infosetOutputFilePath,
},
+ tunables: configValues.tunables,
+ variables: configValues.variables,
tdmlConfig: {
action: configValues.tdmlAction,
name: configValues.tdmlName,
@@ -465,6 +584,8 @@ async function updateConfigValues(config) {
document.getElementById('dfdlDebuggerLogLevel').value =
config.dfdlDebugger.logging.level
+ renderTunables(config.tunables || {})
+ renderVariables(config.variables || {})
updateInfosetOutputType()
updateTDMLAction()
@@ -508,4 +629,20 @@ async function updateDaffodilDebugClasspath(message) {
break
}
})
+
+ // Wait for the webview to signal readiness before sending config.
+ // Prevents the initial config message from being lost, ensuring launch.json
+ // values are rendered on load.
+ window.addEventListener('DOMContentLoaded', () => {
+ // vscode is injected by extension
+ if (typeof vscode !== 'undefined') {
+ const configIndex = getConfigIndex()
+ vscode.postMessage({
+ command: 'updateConfigValue',
+ configIndex: configIndex,
+ })
+ } else {
+ console.error('vscode API not found')
+ }
+ })
})()