Home Download Buy Blog Forum Support

Create and Switch to Project from Plugin

Create and Switch to Project from Plugin

Postby n1ck9 on Thu Sep 19, 2013 12:10 am

Hello! I'm trying to write a plugin that will take a directory location and a project name and create a new project at that destination (if the project doesn't already exist) and switch to it. The problem is that I couldn't find much documentation on the project APIs, so I don't know how to create a project in such a way that it would be added to the recent projects tab, and I don't know how to switch to the project based on the file name. Could someone give me a hand/point me in the right direction? Thanks!
n1ck9
 
Posts: 2
Joined: Thu Sep 19, 2013 12:05 am

Re: Create and Switch to Project from Plugin

Postby adzenith on Thu Sep 19, 2013 1:22 am

Run sublime.log_commands(True) in the console, and it'll print out everything you do. Then you can see what commands are called when you perform different actions.
adzenith
 
Posts: 1213
Joined: Mon Oct 19, 2009 9:12 pm

Re: Create and Switch to Project from Plugin

Postby n1ck9 on Thu Sep 19, 2013 5:27 pm

The problem is that this doesn't really help me find the commands I need. The main menu items are "Open Project", "Switch Project", "Save Project As", and "Open Recent [project]", all of which prompt for user input. If there was a way to see the internals of those functions, so I could see what they do with that user input, that would be great; otherwise, they're not very helpful to me.
n1ck9
 
Posts: 2
Joined: Thu Sep 19, 2013 12:05 am

Re: Create and Switch to Project from Plugin

Postby sapphirehamster on Sun Sep 22, 2013 5:51 pm

Unfortunately there isn't an API to create or open a project that doesn't ask for user input. Creating a project isn't too hard, it's just a json file. To open it, people have written plugins that will shell out and execute the sublime executable which will open a new window. Take a look at the SideBarEnhancements plugin which does this (https://github.com/titoBouzout/SideBarE ... r.py#L1447).
sapphirehamster
 
Posts: 83
Joined: Sun Jul 01, 2012 11:19 pm


Return to Plugin Development

Who is online

Users browsing this forum: No registered users and 6 guests