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 4c1c3f2  Reorder Data Editor OE Shutdown calls
4c1c3f2 is described below

commit 4c1c3f26853a3c55e3e2a5add8d230fe3e0f95eb
Author: Robert Strickland <[email protected]>
AuthorDate: Fri Oct 3 16:21:47 2025 -0500

    Reorder Data Editor OE Shutdown calls
---
 src/dataEditor/dataEditorClient.ts        | 12 ++++++++++--
 src/dataEditor/include/server/Sessions.ts |  6 +++++-
 2 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/src/dataEditor/dataEditorClient.ts 
b/src/dataEditor/dataEditorClient.ts
index ac65eaf..2f3d259 100644
--- a/src/dataEditor/dataEditorClient.ts
+++ b/src/dataEditor/dataEditorClient.ts
@@ -84,6 +84,7 @@ import { getCurrentHeartbeatInfo } from 
'./include/server/heartbeat'
 import * as child_process from 'child_process'
 import { osCheck } from '../utils'
 import { getCurrentConfig } from '../utils'
+import { isDFDLDebugSessionActive } from './include/utils'
 
 // 
*****************************************************************************
 // global constants
@@ -157,7 +158,8 @@ export class DataEditorClient implements vscode.Disposable {
     this.panel.webview.onDidReceiveMessage(this.messageReceiver, this)
 
     this.panel.onDidDispose(async () => {
-      await this.dispose() // session cleanup is now in `static open()`
+      await this.dispose()
+      await removeActiveSession(this.omegaSessionId)
     })
 
     this.disposables = [
@@ -227,7 +229,13 @@ export class DataEditorClient implements vscode.Disposable 
{
       await removeActiveSession(editor.sessionId())
       await editor.dispose()
     })
-
+    if (isDFDLDebugSessionActive()) {
+      editor.addDisposable(
+        vscode.debug.onDidTerminateDebugSession(async () => {
+          editor.dispose()
+        })
+      )
+    }
     return editor
   }
 
diff --git a/src/dataEditor/include/server/Sessions.ts 
b/src/dataEditor/include/server/Sessions.ts
index 7a975d0..d525cc6 100644
--- a/src/dataEditor/include/server/Sessions.ts
+++ b/src/dataEditor/include/server/Sessions.ts
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-import { destroySession, getSessionCount } from '@omega-edit/client'
+import { destroySession, getLogger, getSessionCount } from '@omega-edit/client'
 import { updateHeartbeatInterval } from './heartbeat'
 import { serverStop } from '../../dataEditorClient'
 
@@ -35,6 +35,10 @@ export async function removeActiveSession(sessionId: string) 
{
 
   // Only stop the server if there are no active sessions
   if ((await getSessionCount()) === 0) {
+    getLogger().info(
+      { fn: 'DataEditorClient::removeActiveSession' },
+      'Stopping server!'
+    )
     await serverStop()
   }
 }

Reply via email to