fix: make leave buffer take only a buffer id as argument

leftover
This commit is contained in:
cschen 2025-02-17 22:35:19 +01:00
parent d4f09bc564
commit feed0fa9c9
2 changed files with 5 additions and 14 deletions
main.py
plugin/commands

View file

@ -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

View file

@ -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}'")