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 03b51b5 Don't display infoset file created messages unless it has
content
03b51b5 is described below
commit 03b51b55de417cf7c6f900f7e0bb817a4eb8b55d
Author: Shane Dell <[email protected]>
AuthorDate: Thu Nov 16 21:10:13 2023 -0500
Don't display infoset file created messages unless it has content
Closes #847
---
src/infoset.ts | 31 +++++++++++++++++--------------
1 file changed, 17 insertions(+), 14 deletions(-)
diff --git a/src/infoset.ts b/src/infoset.ts
index 1f2a02b..9f704bb 100644
--- a/src/infoset.ts
+++ b/src/infoset.ts
@@ -39,22 +39,25 @@ async function openInfosetFilePrompt() {
? config.infosetOutput.path.replace('${workspaceFolder}', rootPath)
: config.infosetOutput.path
- const action = await vscode.window.showInformationMessage(
- `Wrote infoset file to ${path}`,
- 'Open',
- 'Dismiss'
- )
-
let uri = vscode.Uri.parse(path)
- switch (action) {
- case 'Open':
- let infoset = await vscode.workspace.openTextDocument(uri)
- await vscode.window.showTextDocument(infoset, {
- preview: false,
- viewColumn: vscode.ViewColumn.One,
- })
- break
+ // Only prompt to open infoset file if it has content
+ if (fs.readFileSync(uri.fsPath).toString() !== '') {
+ const action = await vscode.window.showInformationMessage(
+ `Wrote infoset file to ${path}`,
+ 'Open',
+ 'Dismiss'
+ )
+
+ switch (action) {
+ case 'Open':
+ let infoset = await vscode.workspace.openTextDocument(uri)
+ await vscode.window.showTextDocument(infoset, {
+ preview: false,
+ viewColumn: vscode.ViewColumn.One,
+ })
+ break
+ }
}
}
}