From 086ff46c1bdf59f3a7e9f5945e68fcfca9462180 Mon Sep 17 00:00:00 2001
From: cschen <camillo.schenone@gmail.com>
Date: Mon, 17 Feb 2025 23:34:38 +0100
Subject: [PATCH] add comment for the fucking sublime crashing voodoo, I have
 no idea...

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

diff --git a/plugin/commands/workspace.py b/plugin/commands/workspace.py
index 8a2d518..a2012f7 100644
--- a/plugin/commands/workspace.py
+++ b/plugin/commands/workspace.py
@@ -101,15 +101,15 @@ class CodempLeaveBufferCommand(sublime_plugin.WindowCommand):
             logging.error("The desired buffer is not managed by the workspace.")
             return
 
+        # The call must happen separately, otherwise it causes sublime to crash...
+        # no idea why...
         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}.")
-                else:
-                    logger.debug(f"successfully detached from {buffer_id}.")
-        sublime.set_timeout_async(_)
+            buffers.remove(buffer_id)
+            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}.")
+        sublime.set_timeout(_, 10)
 
 # Leave Buffer Comand
 class CodempCreateBufferCommand(sublime_plugin.WindowCommand):
@@ -155,6 +155,7 @@ class CodempDeleteBufferCommand(sublime_plugin.WindowCommand):
         return "Delete buffer: "
 
     def input(self, args):
+        # FIXME: THIS DOES NOT WORK SORRY
         if "workspace_id" not in args:
             return SimpleListInput(
                 ("workspace_id", session.get_workspaces(owned=True, invited=False)),