This is an automated email from the ASF dual-hosted git repository.
rstrickland 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 bd2f533 Display Data Editor tab name displays file base name and
start omegaEdit after file prompt
bd2f533 is described below
commit bd2f5334d9cb396ddcf664af12818c0b1c6d6bd3
Author: Jeremy Yao <[email protected]>
AuthorDate: Mon Nov 10 10:00:43 2025 -0500
Display Data Editor tab name displays file base name and start omegaEdit
after file prompt
Closes #1523
Closes #1525
---
src/dataEditor/dataEditorClient.ts | 25 ++++++++++++++++++++++++-
src/tests/suite/dataEditor.test.ts | 6 +++++-
2 files changed, 29 insertions(+), 2 deletions(-)
diff --git a/src/dataEditor/dataEditorClient.ts
b/src/dataEditor/dataEditorClient.ts
index 9404906..0765a00 100644
--- a/src/dataEditor/dataEditorClient.ts
+++ b/src/dataEditor/dataEditorClient.ts
@@ -198,7 +198,8 @@ export class DataEditorClient implements vscode.Disposable {
configVars: editor_config.IConfig,
fileToEdit: string = ''
): Promise<DataEditorClient | undefined> {
- const title = 'Data Editor'
+ const title = !fileToEdit ? 'Data Editor' : path.basename(fileToEdit)
+
const column =
fileToEdit !== '' ? vscode.ViewColumn.Two : vscode.ViewColumn.Active
@@ -903,6 +904,28 @@ async function createDataEditorWebviewPanel(
launchConfigVars: editor_config.IConfig,
fileToEdit: string
): Promise<DataEditorClient | undefined> {
+ //prompt file prompt first.
+ if (!fileToEdit) {
+ const fileUri = await vscode.window.showOpenDialog({
+ canSelectMany: false,
+ openLabel: 'Select',
+ canSelectFiles: true,
+ canSelectFolders: false,
+ title: 'Select Data File',
+ })
+
+ // If user cancels file prompt, display info message
+ if (!fileUri || !fileUri[0]) {
+ vscode.window.showInformationMessage(
+ 'Data Editor file opening cancelled.'
+ )
+ return
+ }
+
+ // file was selected by user, note file path to selected file
+ fileToEdit = fileUri[0].fsPath
+ }
+
// Ensure the app data path exists
fs.mkdirSync(APP_DATA_PATH, { recursive: true })
assert(fs.existsSync(APP_DATA_PATH), 'app data path does not exist')
diff --git a/src/tests/suite/dataEditor.test.ts
b/src/tests/suite/dataEditor.test.ts
index 07dea5b..4d41f1d 100644
--- a/src/tests/suite/dataEditor.test.ts
+++ b/src/tests/suite/dataEditor.test.ts
@@ -146,7 +146,11 @@ suite('Data Editor Test Suite', () => {
await vscode.commands.executeCommand(DATA_EDITOR_COMMAND, TEST_SCHEMA)
assert.ok(dataEditWebView)
assert.strictEqual(dataEditWebView.panel.active, true)
- assert.strictEqual(dataEditWebView.panel.title, 'Data Editor')
+ assert.strictEqual(
+ // Check if data editor panel has the basename of the file
+ dataEditWebView.panel.title,
+ path.basename(TEST_SCHEMA)
+ )
// Listen for the dispose event
let isDisposed = false