mirror of
https://github.com/hexedtech/codemp-sublime.git
synced 2025-03-26 19:41:31 +01:00
fix: make leave buffer take only a buffer id as argument
leftover
This commit is contained in:
parent
d4f09bc564
commit
feed0fa9c9
2 changed files with 5 additions and 14 deletions
4
main.py
4
main.py
|
@ -183,10 +183,8 @@ class CodempClientViewEventListener(sublime_plugin.ViewEventListener):
|
||||||
safe_listener_detach(TEXT_LISTENER) # pyright: ignore
|
safe_listener_detach(TEXT_LISTENER) # pyright: ignore
|
||||||
try:
|
try:
|
||||||
bid = buffid_from_view(self.view)
|
bid = buffid_from_view(self.view)
|
||||||
vws = buffers.lookupParent(bid)
|
|
||||||
some(self.view.window()).run_command(
|
some(self.view.window()).run_command(
|
||||||
"codemp_leave_buffer",
|
"codemp_leave_buffer", {"buffer_id": bid})
|
||||||
{"workspace_id": vws.id, "buffer_id": bid})
|
|
||||||
except KeyError:
|
except KeyError:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
|
@ -82,22 +82,15 @@ class CodempLeaveBufferCommand(sublime_plugin.WindowCommand):
|
||||||
return "Leave: "
|
return "Leave: "
|
||||||
|
|
||||||
def input(self, args):
|
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:
|
if "buffer_id" not in args:
|
||||||
bflist = [bf.id for bf in buffers.lookup(args["workspace_id"])]
|
|
||||||
return SimpleListInput(
|
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:
|
try:
|
||||||
buffers.lookupId(buffer_id)
|
buff = buffers.lookupId(buffer_id)
|
||||||
vws = workspaces.lookupId(workspace_id)
|
vws = buffers.lookupParent(buff)
|
||||||
except KeyError:
|
except KeyError:
|
||||||
sublime.error_message(f"You are not attached to the buffer '{buffer_id}'")
|
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}'")
|
logging.warning(f"You are not attached to the buffer '{buffer_id}'")
|
||||||
|
|
Loading…
Add table
Reference in a new issue