mirror of
https://github.com/hexedtech/codemp-sublime.git
synced 2025-03-24 19:01:32 +01:00
fix join buffer input handlers
This commit is contained in:
parent
ce87c5334d
commit
4c64797ab9
1 changed files with 16 additions and 17 deletions
|
@ -22,22 +22,24 @@ class CodempJoinBufferCommand(sublime_plugin.WindowCommand):
|
|||
return "Join Buffer: "
|
||||
|
||||
def input(self, args):
|
||||
if "workspace_id" not in args:
|
||||
wslist = session.client.active_workspaces()
|
||||
return SimpleListInput(
|
||||
("workspace_id", wslist),
|
||||
)
|
||||
for name in ["workspace_id", "buffer_id"]:
|
||||
if name not in args:
|
||||
if name == "workspace_id":
|
||||
wslist = session.client.active_workspaces()
|
||||
return SimpleListInput(
|
||||
("workspace_id", wslist),
|
||||
)
|
||||
|
||||
if "buffer_id" not in args:
|
||||
try: ws = workspaces.lookupId(args["workspace_id"])
|
||||
except KeyError:
|
||||
sublime.error_message("Workspace does not exists or is not active.")
|
||||
return None
|
||||
if name == "buffer_id":
|
||||
try: ws = workspaces.lookupId(args["workspace_id"])
|
||||
except KeyError:
|
||||
sublime.error_message("Workspace does not exists or is not active.")
|
||||
return None
|
||||
|
||||
bflist = ws.handle.fetch_buffers().wait()
|
||||
return SimpleListInput(
|
||||
("buffer_id", bflist),
|
||||
)
|
||||
bflist = ws.handle.fetch_buffers().wait()
|
||||
return SimpleListInput(
|
||||
("buffer_id", bflist),
|
||||
)
|
||||
|
||||
def run(self, workspace_id, buffer_id): # pyright: ignore[reportIncompatibleMethodOverride]
|
||||
try: vws = workspaces.lookupId(workspace_id)
|
||||
|
@ -47,8 +49,6 @@ class CodempJoinBufferCommand(sublime_plugin.WindowCommand):
|
|||
|
||||
try: # if it exists already, focus and listen
|
||||
buff = buffers.lookupId(buffer_id)
|
||||
# safe_listener_detach(TEXT_LISTENER)
|
||||
# safe_listener_attach(TEXT_LISTENER, buff.view.buffer())
|
||||
self.window.focus_view(buff.view)
|
||||
return
|
||||
except KeyError:
|
||||
|
@ -67,7 +67,6 @@ class CodempJoinBufferCommand(sublime_plugin.WindowCommand):
|
|||
sublime.error_message(f"Could not attach to buffer '{buffer_id}'")
|
||||
return
|
||||
|
||||
|
||||
vbuff = buffers.register(buff_ctl, vws)
|
||||
vbuff.sync(TEXT_LISTENER)
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue