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 faa102e  Fix multiple bugs with infoset files.
faa102e is described below

commit faa102e3ab132c98d3120e3757bd280c54d67445
Author: Shane Dell <[email protected]>
AuthorDate: Fri Mar 22 12:27:50 2024 -0400

    Fix multiple bugs with infoset files.
    
    - Resolve issue where the infoset popup to open infoset didn't actually 
open the infoset on windows.
    - Resolve issue where the infoset.save command was trying to save to 
file://<filename> instead of file://${workspaceFolder}/<filename>.
      - The above would also cause the file not to be able to be opened or 
deleted.
    
    Closes #972
---
 src/infoset.ts | 31 ++++++++++++-------
 yarn.lock      | 98 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 117 insertions(+), 12 deletions(-)

diff --git a/src/infoset.ts b/src/infoset.ts
index 6f8f20a..1f02d06 100644
--- a/src/infoset.ts
+++ b/src/infoset.ts
@@ -25,6 +25,7 @@ import {
   ensureFile,
   tmpFile,
 } from './utils'
+import * as path from 'path'
 
 // Function to display an infomation message that the infoset file has been 
created
 // If the user wishes to open the file then they may click the 'Open' button
@@ -35,16 +36,16 @@ async function openInfosetFilePrompt() {
     let rootPath = vscode.workspace.workspaceFolders
       ? vscode.workspace.workspaceFolders[0].uri.fsPath
       : vscode.Uri.parse('').fsPath
-    let path = config.infosetOutput.path.includes('${workspaceFolder}')
+    let infosetPath = config.infosetOutput.path.includes('${workspaceFolder}')
       ? config.infosetOutput.path.replace('${workspaceFolder}', rootPath)
       : config.infosetOutput.path
 
-    let uri = vscode.Uri.parse(path)
+    let uri = vscode.Uri.file(infosetPath)
 
     // 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}`,
+        `Wrote infoset file to ${infosetPath}`,
         'Open',
         'Dismiss'
       )
@@ -75,9 +76,9 @@ export async function activate(ctx: vscode.ExtensionContext) {
   ctx.subscriptions.push(
     vscode.debug.onDidTerminateDebugSession(async (s) => {
       if (sid !== undefined) {
-        let path = tmpFile(sid)
-        fs.rmSync(`${path}`, { force: true })
-        fs.rmSync(`${path}.prev`, { force: true })
+        let filepath = tmpFile(sid)
+        fs.rmSync(`${filepath}`, { force: true })
+        fs.rmSync(`${filepath}.prev`, { force: true })
       }
       sid = undefined
       await openInfosetFilePrompt()
@@ -94,8 +95,8 @@ export async function activate(ctx: vscode.ExtensionContext) {
   ctx.subscriptions.push(
     vscode.commands.registerCommand('infoset.display', async () => {
       if (sid !== undefined) {
-        let path = ensureFile(tmpFile(sid))
-        doc = await vscode.workspace.openTextDocument(path)
+        let filepath = ensureFile(tmpFile(sid))
+        doc = await vscode.workspace.openTextDocument(filepath)
         await vscode.window.showTextDocument(doc, {
           viewColumn: vscode.ViewColumn.Two,
           preserveFocus: true,
@@ -114,13 +115,19 @@ export async function activate(ctx: 
vscode.ExtensionContext) {
             placeHolder: 'Save infoset as:',
           })
           if (dest) {
+            let rootPath = vscode.workspace.workspaceFolders
+              ? vscode.workspace.workspaceFolders[0].uri.fsPath
+              : vscode.Uri.parse('').fsPath
+
+            dest = path.join(rootPath, dest)
+
             fs.copyFile(tmpFile(sid), dest, async () => {
               const choice = await vscode.window.showInformationMessage(
                 `Wrote infoset to ${dest}`,
                 'View',
                 'Delete'
               )
-              let uri = Uri.parse(dest!)
+              let uri = Uri.file(dest!)
               switch (choice) {
                 case 'View':
                   let xml = await vscode.workspace.openTextDocument(uri)
@@ -143,12 +150,12 @@ export async function activate(ctx: 
vscode.ExtensionContext) {
   ctx.subscriptions.push(
     vscode.commands.registerCommand('infoset.diff', async () => {
       if (sid !== undefined) {
-        let path = ensureFile(tmpFile(sid))
-        let prev = ensureFile(`${path}.prev`)
+        let filepath = ensureFile(tmpFile(sid))
+        let prev = ensureFile(`${filepath}.prev`)
         vscode.commands.executeCommand(
           'vscode.diff',
           Uri.file(prev),
-          Uri.file(path),
+          Uri.file(filepath),
           'Previous ↔ Current',
           { preview: false, viewColumn: vscode.ViewColumn.Two }
         )
diff --git a/yarn.lock b/yarn.lock
index da287ea..43a2c53 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -139,6 +139,16 @@
     "@grpc/proto-loader" "^0.7.8"
     "@types/node" ">=12.12.47"
 
+"@grpc/proto-loader@^0.7.8":
+  version "0.7.10"
+  resolved 
"https://registry.yarnpkg.com/@grpc/proto-loader/-/proto-loader-0.7.10.tgz#6bf26742b1b54d0a473067743da5d3189d06d720";
+  integrity 
sha512-CAqDfoaQ8ykFd9zqBDn4k6iWT9loLAlc2ETmDFS9JCD70gDcnA4L3AFEo2iV7KyAtAAHFW9ftq1Fz+Vsgq80RQ==
+  dependencies:
+    lodash.camelcase "^4.3.0"
+    long "^5.0.0"
+    protobufjs "^7.2.4"
+    yargs "^17.7.2"
+
 "@jest/schemas@^29.6.0":
   version "29.6.0"
   resolved "https://registry.npmjs.org/@jest/schemas/-/schemas-29.6.0.tgz";
@@ -274,6 +284,59 @@
   resolved 
"https://registry.yarnpkg.com/@omega-edit/server/-/server-0.9.78.tgz#16725792f08134fb6c28a463874f4891fb63f08f";
   integrity 
sha512-idSZQHjv28zF47kiKcMKGrVAqhQHtsxBvSNlP3Ergtn9cEXgsymh4fV6WzBi6VtRG8OrUMAhzd9JrN6j0eHR4g==
 
+"@protobufjs/aspromise@^1.1.1", "@protobufjs/aspromise@^1.1.2":
+  version "1.1.2"
+  resolved 
"https://registry.yarnpkg.com/@protobufjs/aspromise/-/aspromise-1.1.2.tgz#9b8b0cc663d669a7d8f6f5d0893a14d348f30fbf";
+  integrity 
sha512-j+gKExEuLmKwvz3OgROXtrJ2UG2x8Ch2YZUxahh+s1F2HZ+wAceUNLkvy6zKCPVRkU++ZWQrdxsUeQXmcg4uoQ==
+
+"@protobufjs/base64@^1.1.2":
+  version "1.1.2"
+  resolved 
"https://registry.yarnpkg.com/@protobufjs/base64/-/base64-1.1.2.tgz#4c85730e59b9a1f1f349047dbf24296034bb2735";
+  integrity 
sha512-AZkcAA5vnN/v4PDqKyMR5lx7hZttPDgClv83E//FMNhR2TMcLUhfRUBHCmSl0oi9zMgDDqRUJkSxO3wm85+XLg==
+
+"@protobufjs/codegen@^2.0.4":
+  version "2.0.4"
+  resolved 
"https://registry.yarnpkg.com/@protobufjs/codegen/-/codegen-2.0.4.tgz#7ef37f0d010fb028ad1ad59722e506d9262815cb";
+  integrity 
sha512-YyFaikqM5sH0ziFZCN3xDC7zeGaB/d0IUb9CATugHWbd1FRFwWwt4ld4OYMPWu5a3Xe01mGAULCdqhMlPl29Jg==
+
+"@protobufjs/eventemitter@^1.1.0":
+  version "1.1.0"
+  resolved 
"https://registry.yarnpkg.com/@protobufjs/eventemitter/-/eventemitter-1.1.0.tgz#355cbc98bafad5978f9ed095f397621f1d066b70";
+  integrity 
sha512-j9ednRT81vYJ9OfVuXG6ERSTdEL1xVsNgqpkxMsbIabzSo3goCjDIveeGv5d03om39ML71RdmrGNjG5SReBP/Q==
+
+"@protobufjs/fetch@^1.1.0":
+  version "1.1.0"
+  resolved 
"https://registry.yarnpkg.com/@protobufjs/fetch/-/fetch-1.1.0.tgz#ba99fb598614af65700c1619ff06d454b0d84c45";
+  integrity 
sha512-lljVXpqXebpsijW71PZaCYeIcE5on1w5DlQy5WH6GLbFryLUrBD4932W/E2BSpfRJWseIL4v/KPgBFxDOIdKpQ==
+  dependencies:
+    "@protobufjs/aspromise" "^1.1.1"
+    "@protobufjs/inquire" "^1.1.0"
+
+"@protobufjs/float@^1.0.2":
+  version "1.0.2"
+  resolved 
"https://registry.yarnpkg.com/@protobufjs/float/-/float-1.0.2.tgz#5e9e1abdcb73fc0a7cb8b291df78c8cbd97b87d1";
+  integrity 
sha512-Ddb+kVXlXst9d+R9PfTIxh1EdNkgoRe5tOX6t01f1lYWOvJnSPDBlG241QLzcyPdoNTsblLUdujGSE4RzrTZGQ==
+
+"@protobufjs/inquire@^1.1.0":
+  version "1.1.0"
+  resolved 
"https://registry.yarnpkg.com/@protobufjs/inquire/-/inquire-1.1.0.tgz#ff200e3e7cf2429e2dcafc1140828e8cc638f089";
+  integrity 
sha512-kdSefcPdruJiFMVSbn801t4vFK7KB/5gd2fYvrxhuJYg8ILrmn9SKSX2tZdV6V+ksulWqS7aXjBcRXl3wHoD9Q==
+
+"@protobufjs/path@^1.1.2":
+  version "1.1.2"
+  resolved 
"https://registry.yarnpkg.com/@protobufjs/path/-/path-1.1.2.tgz#6cc2b20c5c9ad6ad0dccfd21ca7673d8d7fbf68d";
+  integrity 
sha512-6JOcJ5Tm08dOHAbdR3GrvP+yUUfkjG5ePsHYczMFLq3ZmMkAD98cDgcT2iA1lJ9NVwFd4tH/iSSoe44YWkltEA==
+
+"@protobufjs/pool@^1.1.0":
+  version "1.1.0"
+  resolved 
"https://registry.yarnpkg.com/@protobufjs/pool/-/pool-1.1.0.tgz#09fd15f2d6d3abfa9b65bc366506d6ad7846ff54";
+  integrity 
sha512-0kELaGSIDBKvcgS4zkjz1PeddatrjYcmMWOlAuAPwAeccUrPHdUqo/J6LiymHHEiJT5NrF1UVwxY14f+fy4WQw==
+
+"@protobufjs/utf8@^1.1.0":
+  version "1.1.0"
+  resolved 
"https://registry.yarnpkg.com/@protobufjs/utf8/-/utf8-1.1.0.tgz#a777360b5b39a1a2e5106f8e858f2fd2d060c570";
+  integrity 
sha512-Vvn3zZrhQZkkBE8LSuW3em98c0FwgO4nxzv6OdSxPKJIEKY2bGbHn+mhGIPerzI4twdxaP8/0+06HBpwf345Lw==
+
 "@sinclair/typebox@^0.27.8":
   version "0.27.8"
   resolved "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.27.8.tgz";
@@ -406,6 +469,13 @@
   dependencies:
     undici-types "~5.26.4"
 
+"@types/node@>=12.12.47", "@types/node@>=13.7.0":
+  version "20.11.30"
+  resolved 
"https://registry.yarnpkg.com/@types/node/-/node-20.11.30.tgz#9c33467fc23167a347e73834f788f4b9f399d66f";
+  integrity 
sha512-dHM6ZxwlmuZaRmUPfv1p+KrdD1Dci04FbdEm/9wEMouFqxYoFl5aMkt0VMAUtYRQDyYvD41WJLukhq/ha3YuTw==
+  dependencies:
+    undici-types "~5.26.4"
+
 "@types/node@^20.8.7":
   version "20.11.5"
   resolved 
"https://registry.yarnpkg.com/@types/node/-/node-20.11.5.tgz#be10c622ca7fcaa3cf226cf80166abc31389d86e";
@@ -2342,6 +2412,11 @@ locate-path@^6.0.0:
   dependencies:
     p-locate "^5.0.0"
 
+lodash.camelcase@^4.3.0:
+  version "4.3.0"
+  resolved 
"https://registry.yarnpkg.com/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz#b28aa6288a2b9fc651035c7711f65ab6190331a6";
+  integrity 
sha512-TwuEnCnxbc3rAvhf/LbG7tJUDzhqXyFnv3dtzLOPgCG/hODL7WFnsbwktkD7yUV0RrreP/l1PALq/YSg6VvjlA==
+
 lodash.memoize@^4.1.2:
   version "4.1.2"
   resolved 
"https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-4.1.2.tgz";
@@ -2365,6 +2440,11 @@ [email protected]:
     chalk "^4.1.0"
     is-unicode-supported "^0.1.0"
 
+long@^5.0.0:
+  version "5.2.3"
+  resolved 
"https://registry.yarnpkg.com/long/-/long-5.2.3.tgz#a3ba97f3877cf1d778eccbcb048525ebb77499e1";
+  integrity 
sha512-lcHwpNoggQTObv5apGNCTdJrO69eHOZMi4BNC+rTLER8iHAqGrUVeLh/irVIM7zTw2bOXA8T6uNPeujwOLg/2Q==
+
 loupe@^2.3.6:
   version "2.3.7"
   resolved "https://registry.npmjs.org/loupe/-/loupe-2.3.7.tgz";
@@ -3115,6 +3195,24 @@ process@^0.11.10:
   resolved "https://registry.npmjs.org/process/-/process-0.11.10.tgz";
   integrity 
sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A==
 
+protobufjs@^7.2.4:
+  version "7.2.6"
+  resolved 
"https://registry.yarnpkg.com/protobufjs/-/protobufjs-7.2.6.tgz#4a0ccd79eb292717aacf07530a07e0ed20278215";
+  integrity 
sha512-dgJaEDDL6x8ASUZ1YqWciTRrdOuYNzoOf27oHNfdyvKqHr5i0FV7FSLU+aIeFjyFgVxrpTOtQUi0BLLBymZaBw==
+  dependencies:
+    "@protobufjs/aspromise" "^1.1.2"
+    "@protobufjs/base64" "^1.1.2"
+    "@protobufjs/codegen" "^2.0.4"
+    "@protobufjs/eventemitter" "^1.1.0"
+    "@protobufjs/fetch" "^1.1.0"
+    "@protobufjs/float" "^1.0.2"
+    "@protobufjs/inquire" "^1.1.0"
+    "@protobufjs/path" "^1.1.2"
+    "@protobufjs/pool" "^1.1.0"
+    "@protobufjs/utf8" "^1.1.0"
+    "@types/node" ">=13.7.0"
+    long "^5.0.0"
+
 pump@^1.0.0:
   version "1.0.3"
   resolved "https://registry.npmjs.org/pump/-/pump-1.0.3.tgz";

Reply via email to