From ed29c0c62a2424d6d66c82e562566b56bb5408b1 Mon Sep 17 00:00:00 2001
From: cschen <camillo.schenone@gmail.com>
Date: Mon, 17 Feb 2025 22:51:39 +0100
Subject: [PATCH] remove the timeout async call

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

diff --git a/plugin/commands/workspace.py b/plugin/commands/workspace.py
index ded17b4..31694e8 100644
--- a/plugin/commands/workspace.py
+++ b/plugin/commands/workspace.py
@@ -101,15 +101,17 @@ class CodempLeaveBufferCommand(sublime_plugin.WindowCommand):
             logging.error("The desired buffer is not managed by the workspace.")
             return
 
-        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(_)
+        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}.")
 
-# Leave Buffer Comand
+# Create Buffer Comand
 class CodempCreateBufferCommand(sublime_plugin.WindowCommand):
     def is_enabled(self):
         return len(workspaces.lookup()) > 0