Sublime Forum

STProjectMaker

#1

Recently, I installed a package on Sublime, which is “STProjectMaker”. Is there a way to make my template open in the sidebar after I created it?

Also, I explored the package class and found this:

def create_project(self):
    self.copy_project()
    self.get_tokens(self.project_path)
    self.get_token_values()

def copy_project(self):
    if not os.path.exists(self.project_path):
        shutil.copytree(self.chosen_template_path, self.project_path)
    else:
        self.copy_in_non_empty()

Is this where I should put some code for it?

Full code: https://github.com/bit101/STProjectMaker/blob/master/projectmaker.py

0 Likes

#2

I haven’t tested this, but you could perhaps do something like this:

from STProjectMaker.projectmaker import ProjectMakerCommand
import sublime

class MyProjectMakerCommand(ProjectMakerCommand):
    
    def create_project_file(self):
        super(ProjectMakerCommand, self).create_project_file()
        sublime.run_command('open_file', args={'file': self.project_file})

save as MyProjectMakerCommand.py inside Packages/User directory and invoke it with a keybinding.

0 Likes