From c97a276d71112a1ba85bd6ab2ab02ba73b159f02 Mon Sep 17 00:00:00 2001 From: cschen <camillo.schenone@gmail.com> Date: Mon, 17 Feb 2025 22:36:31 +0100 Subject: [PATCH] fix create buffer input handlers --- plugin/commands/workspace.py | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/plugin/commands/workspace.py b/plugin/commands/workspace.py index a36fa6d..cbee233 100644 --- a/plugin/commands/workspace.py +++ b/plugin/commands/workspace.py @@ -117,16 +117,17 @@ class CodempCreateBufferCommand(sublime_plugin.WindowCommand): return "Create Buffer: " 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: - return SimpleTextInput( - ("buffer_id", "new buffer name"), - ) + missingargs = [arg for arg in ["workspace_id", "buffer_id"] if arg not in args] + for arg in missingargs: + if arg == "workspace_id": + return SimpleListInput([ + ("workspace_id", session.client.active_workspaces()), + ("buffer_id", "new buffer name") + ]) + if arg == "buffer_id": + return SimpleTextInput( + ("buffer_id", "new buffer name"), + ) def run(self, workspace_id, buffer_id):# pyright: ignore[reportIncompatibleMethodOverride] try: vws = workspaces.lookupId(workspace_id)