From 6fe34f7bdbb74252f5e6df13b7bf50a42f12b9f8 Mon Sep 17 00:00:00 2001
From: cschen <camillo.schenone@gmail.com>
Date: Mon, 17 Feb 2025 22:56:24 +0100
Subject: [PATCH] Revert "remove the timeout async call"

This reverts commit ed29c0c62a2424d6d66c82e562566b56bb5408b1.
---
 plugin/commands/workspace.py | 18 ++++++++----------
 1 file changed, 8 insertions(+), 10 deletions(-)

diff --git a/plugin/commands/workspace.py b/plugin/commands/workspace.py
index 9dc8b7f..83892e8 100644
--- a/plugin/commands/workspace.py
+++ b/plugin/commands/workspace.py
@@ -101,17 +101,15 @@ class CodempLeaveBufferCommand(sublime_plugin.WindowCommand):
             logging.error("The desired buffer is not managed by the workspace.")
             return
 
-        try:
-            buffers.remove(buffer_id)
-            # del buff
-            # gc.collect()
-        finally:
-            if not vws.handle.detach_buffer(buffer_id):
-                logger.error(f"could not leave the buffer {buffer_id}.")
-            else:
-                logger.debug(f"successfully detached from {buffer_id}.")
+        def _():
+            try:
+                buffers.remove(buffer_id)
+            finally:
+                if not vws.handle.detach_buffer(buffer_id):
+                    logger.error(f"could not leave the buffer {buffer_id}.")
+        sublime.set_timeout_async(_)
 
-# Create Buffer Comand
+# Leave Buffer Comand
 class CodempCreateBufferCommand(sublime_plugin.WindowCommand):
     def is_enabled(self):
         return len(workspaces.lookup()) > 0