Sublime Forum

Pass path and name in "save_workspace_as"

#1

Hi folks,
Just want to develop a tiny sublime plugin for sublime newbies in my team.
The plugin targets to combine save_workspace_as and prompt_add_folder together so they can onboard with sublime workspace faster…
I use sublime.log_command(True) to find out how to run save_workspace_as from a window, but I don’t find any documentation about this command, also prompt_add_folder.
I am thinking if I can do something like this

window.run_command(‘save_workspace_as’,
args = {‘path’:‘Uniform workspace path’,
‘workspace_name’:‘Workspace name from input panel’
}
)

The path is a uniformed path, something like c:user\username\sublime_workspace
And the plugin is gonna check if this path exists, using os.path.exists(), if not use os.mkdir to create one

The workspace name is an input from window.show_input_panel

The ultimate goal is user when call this plugin, they only see the add folder dialog instead of the both

I try to explain the idea of workspace and project folder, I found the new user takes a while to understand this and not use workspace and folder sidebar at all. One of the major reason is they don’t remember where the workspace is saved at, and they are not used to use ctrl+alt+p to switch workspace initially.
That’s why I am thinking if I can combine these two together

Also, may I know how to check the source code of some sublime command? For example, save_workspace_as can’t found anywhere in the API, if I can check the source code, at least I can understand the parameters name

Thank y’all very much!!!

0 Likes