diff --git a/main.py b/main.py index e15bdab..2b6cdcf 100644 --- a/main.py +++ b/main.py @@ -183,10 +183,8 @@ class CodempClientViewEventListener(sublime_plugin.ViewEventListener): safe_listener_detach(TEXT_LISTENER) # pyright: ignore try: bid = buffid_from_view(self.view) - vws = buffers.lookupParent(bid) some(self.view.window()).run_command( - "codemp_leave_buffer", - {"workspace_id": vws.id, "buffer_id": bid}) + "codemp_leave_buffer", {"buffer_id": bid}) except KeyError: return diff --git a/plugin/commands/workspace.py b/plugin/commands/workspace.py index c1895a1..a36fa6d 100644 --- a/plugin/commands/workspace.py +++ b/plugin/commands/workspace.py @@ -82,22 +82,15 @@ class CodempLeaveBufferCommand(sublime_plugin.WindowCommand): return "Leave: " def input(self, args): - if "workspace_id" not in args: - wslist = session.client.active_workspaces() - return SimpleListInput( - ("workspace_id", wslist), - ) - if "buffer_id" not in args: - bflist = [bf.id for bf in buffers.lookup(args["workspace_id"])] return SimpleListInput( - ("buffer_id", bflist) + ("buffer_id", [bf.id for bf in buffers.lookup()]) ) - def run(self, workspace_id, buffer_id): # pyright: ignore[reportIncompatibleMethodOverride] + def run(self, buffer_id): # pyright: ignore[reportIncompatibleMethodOverride] try: - buffers.lookupId(buffer_id) - vws = workspaces.lookupId(workspace_id) + buff = buffers.lookupId(buffer_id) + vws = buffers.lookupParent(buff) except KeyError: sublime.error_message(f"You are not attached to the buffer '{buffer_id}'") logging.warning(f"You are not attached to the buffer '{buffer_id}'")