This is an automated email from the ASF dual-hosted git repository.
rthomas320 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 336a084 Updated package.json and TDMLProvider.ts to fix visibility of
commands
336a084 is described below
commit 336a084e0c12e62d942b47f0c8d977f700d044a2
Author: Hitesh Dalsania <[email protected]>
AuthorDate: Fri Nov 21 01:42:04 2025 -0500
Updated package.json and TDMLProvider.ts to fix visibility of commands
Address TDML Execute command not prompting for test case when having .tdml
file opened in VS Code
Fixed the bug where append and execute commands were not working from
command explorer, command pallet and menu
---
package.json | 30 +++++++++++++++---------------
src/adapter/activateDaffodilDebug.ts | 11 +++++++++--
src/tdmlEditor/TDMLProvider.ts | 22 +++++++++++++++++++++-
src/utils.ts | 12 ++++++++++++
4 files changed, 57 insertions(+), 18 deletions(-)
diff --git a/package.json b/package.json
index 58113ad..e8355a8 100644
--- a/package.json
+++ b/package.json
@@ -221,17 +221,17 @@
},
{
"command": "tdml-editor.openInTextEditor",
- "when": "activeEditor == 'tdml-editor.editor'",
+ "when": "activeEditor == 'tdml-editor.editor' ||
dfdl-debug.tdml-editor-active == 'tdml-editor.editor'",
"group": "navigation@1"
},
{
"command": "tdml-editor.openPreview",
- "when": "editorLangId == 'tdml' && editorTextFocus",
+ "when": "editorLangId == 'tdml'",
"group": "navigation@1"
},
{
"command": "tdml-editor.openInTdmlEditor",
- "when": "editorLangId == 'tdml' && editorTextFocus",
+ "when": "editorLangId == 'tdml'",
"group": "navigation@1"
}
],
@@ -256,11 +256,11 @@
},
{
"command": "extension.dfdl-debug.appendTDML",
- "when": "!inDebugMode && ((editorLangId == 'tdml' &&
editorTextFocus) || activeEditor == 'tdml-editor.editor')"
+ "when": "!inDebugMode && (editorLangId == 'tdml' || activeEditor ==
'tdml-editor.editor' || dfdl-debug.tdml-editor-active == 'tdml-editor.editor')"
},
{
"command": "extension.dfdl-debug.executeTDML",
- "when": "!inDebugMode && ((editorLangId == 'tdml' &&
editorTextFocus) || activeEditor == 'tdml-editor.editor')"
+ "when": "!inDebugMode && (editorLangId == 'tdml' || activeEditor ==
'tdml-editor.editor' || dfdl-debug.tdml-editor-active == 'tdml-editor.editor')"
}
],
"commandPalette": [
@@ -274,11 +274,11 @@
},
{
"command": "extension.dfdl-debug.appendTDML",
- "when": "!inDebugMode && ((editorLangId == 'tdml' &&
editorTextFocus) || activeEditor == 'tdml-editor.editor')"
+ "when": "!inDebugMode && (editorLangId == 'tdml' || activeEditor ==
'tdml-editor.editor' || dfdl-debug.tdml-editor-active == 'tdml-editor.editor')"
},
{
"command": "extension.dfdl-debug.executeTDML",
- "when": "!inDebugMode && ((editorLangId == 'tdml' &&
editorTextFocus) || activeEditor == 'tdml-editor.editor')"
+ "when": "!inDebugMode && (editorLangId == 'tdml' || activeEditor ==
'tdml-editor.editor' || dfdl-debug.tdml-editor-active == 'tdml-editor.editor')"
},
{
"command": "extension.dfdl-debug.createTDML",
@@ -302,15 +302,15 @@
},
{
"command": "tdml-editor.openInTextEditor",
- "when": "activeEditor == 'tdml-editor.editor'"
+ "when": "activeEditor == 'tdml-editor.editor' ||
dfdl-debug.tdml-editor-active == 'tdml-editor.editor'"
},
{
"command": "tdml-editor.openPreview",
- "when": "editorLangId == 'tdml' && editorTextFocus"
+ "when": "editorLangId == 'tdml'"
},
{
"command": "tdml-editor.openInTdmlEditor",
- "when": "editorLangId == 'tdml' && editorTextFocus"
+ "when": "editorLangId == 'tdml'"
}
],
"debug/variables/context": [
@@ -356,13 +356,13 @@
"command": "extension.dfdl-debug.appendTDML",
"title": "Append TDML",
"category": "Daffodil Debug",
- "enablement": "!inDebugMode && ((editorLangId == 'tdml' &&
editorTextFocus) || activeEditor == 'tdml-editor.editor')"
+ "enablement": "!inDebugMode && (editorLangId == 'tdml' || activeEditor
== 'tdml-editor.editor' || dfdl-debug.tdml-editor-active ==
'tdml-editor.editor')"
},
{
"command": "extension.dfdl-debug.executeTDML",
"title": "Execute TDML",
"category": "Daffodil Debug",
- "enablement": "!inDebugMode && ((editorLangId == 'tdml' &&
editorTextFocus) || activeEditor == 'tdml-editor.editor')"
+ "enablement": "!inDebugMode && (editorLangId == 'tdml' || activeEditor
== 'tdml-editor.editor' || dfdl-debug.tdml-editor-active ==
'tdml-editor.editor')"
},
{
"command": "extension.dfdl-debug.createTDML",
@@ -432,21 +432,21 @@
"title": "Open in Text Editor",
"category": "TDML Editor",
"icon": "$(notebook-open-as-text)",
- "enablement": "activeEditor == 'tdml-editor.editor'"
+ "enablement": "activeEditor == 'tdml-editor.editor' ||
dfdl-debug.tdml-editor-active == 'tdml-editor.editor'"
},
{
"command": "tdml-editor.openPreview",
"title": "Open Preview",
"category": "TDML Editor",
"icon": "$(open-preview)",
- "enablement": "editorLangId == 'tdml' && editorTextFocus"
+ "enablement": "editorLangId == 'tdml'"
},
{
"command": "tdml-editor.openInTdmlEditor",
"title": "Open in TDML Editor",
"category": "TDML Editor",
"icon": "$(notebook-render-output)",
- "enablement": "editorLangId == 'tdml' && editorTextFocus"
+ "enablement": "editorLangId == 'tdml'"
}
],
"keybindings": [
diff --git a/src/adapter/activateDaffodilDebug.ts
b/src/adapter/activateDaffodilDebug.ts
index bb5ee1b..8bcbca7 100644
--- a/src/adapter/activateDaffodilDebug.ts
+++ b/src/adapter/activateDaffodilDebug.ts
@@ -256,8 +256,15 @@ export function activateDaffodilDebug(
let targetResource = resource
- if (!targetResource && vscode.window.activeTextEditor) {
- targetResource = vscode.window.activeTextEditor.document.uri
+ if (!targetResource) {
+ if (vscode.window.activeTextEditor) {
+ targetResource = vscode.window.activeTextEditor.document.uri
+ } else {
+ const tdmlUri = TDMLProvider.getDocumentUri()
+ if (tdmlUri) {
+ targetResource = tdmlUri
+ }
+ }
}
if (targetResource) {
appendTestCase(getTmpTDMLFilePath(), targetResource.fsPath)
diff --git a/src/tdmlEditor/TDMLProvider.ts b/src/tdmlEditor/TDMLProvider.ts
index e87ddf3..1da3fda 100644
--- a/src/tdmlEditor/TDMLProvider.ts
+++ b/src/tdmlEditor/TDMLProvider.ts
@@ -63,18 +63,33 @@ export class TDMLProvider implements
vscode.CustomTextEditorProvider {
webviewPanel.webview.html = this._getWebviewContent(webviewPanel.webview)
webviewPanel.onDidChangeViewState((e) => {
this.currentPanel = e.webviewPanel
-
+ // Create a custom context key 'dfdl-debug.tdml-editor-active' to diplay
appropriate commands on menu/editor/title bar and command pallet.
if (e.webviewPanel.active) {
TDMLProvider.currentUri = document.uri
+ vscode.commands.executeCommand(
+ 'setContext',
+ 'dfdl-debug.tdml-editor-active',
+ TDMLProvider.viewType
+ )
} else if (
TDMLProvider.currentUri?.toString() === document.uri.toString()
) {
TDMLProvider.currentUri = undefined
+ vscode.commands.executeCommand(
+ 'setContext',
+ 'dfdl-debug.tdml-editor-active',
+ undefined
+ )
}
})
if (webviewPanel.active) {
TDMLProvider.currentUri = document.uri
+ vscode.commands.executeCommand(
+ 'setContext',
+ 'dfdl-debug.tdml-editor-active',
+ TDMLProvider.viewType
+ )
}
try {
@@ -148,6 +163,11 @@ export class TDMLProvider implements
vscode.CustomTextEditorProvider {
if (TDMLProvider.currentUri?.toString() === document.uri.toString()) {
TDMLProvider.currentUri = undefined
+ vscode.commands.executeCommand(
+ 'setContext',
+ 'dfdl-debug.tdml-editor-active',
+ undefined
+ )
}
})
diff --git a/src/utils.ts b/src/utils.ts
index 9a3aee8..8854bc7 100644
--- a/src/utils.ts
+++ b/src/utils.ts
@@ -210,6 +210,18 @@ export function getConfig(jsonArgs: object):
vscode.DebugConfiguration {
)
}
+ // VVVVVVVVVVVVVVVVVVVVVVVV COMPARTMENTALIZED FIX FOR THIRD BULLET POINT OF
https://github.com/apache/daffodil-vscode/issues/1540 VVVVVVVVVVVVVVVVVVVVVVVV
+ // Handle setting test case name for TDML Execute action if it's not
specified.
+ // This resolves the issue of always defualting to `Default Test Case` even
thought a test case name isn't specified when we click on `Execute TDML` when
we have opened TDML file
+ const args = jsonArgs as VSCodeLaunchConfigArgs // cast needed b/c of VS
Code Typescript errors
+ if (
+ args.tdmlConfig?.action === 'execute' &&
+ args.tdmlConfig?.name === undefined
+ ) {
+ launchConfigArgs.tdmlConfig.name = undefined
+ }
+ // ^^^^^^^^^^^^^^^^^^^^^^^^ COMPARTMENTALIZED FIX FOR THIRD BULLET POINT OF
https://github.com/apache/daffodil-vscode/issues/1540 ^^^^^^^^^^^^^^^^^^^^^^^^
+
return JSON.parse(JSON.stringify(launchConfigArgs))
}