From feed0fa9c99c11c6517a23c1b8c8755f94f4e815 Mon Sep 17 00:00:00 2001 From: cschen <camillo.schenone@gmail.com> Date: Mon, 17 Feb 2025 22:35:19 +0100 Subject: [PATCH] fix: make leave buffer take only a buffer id as argument leftover --- main.py | 4 +--- plugin/commands/workspace.py | 15 ++++----------- 2 files changed, 5 insertions(+), 14 deletions(-) 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}'")