Sublime Forum

Plugin Bootstrapping Plugin

#1

Hey folks,

is there a plugin which generates a plugin:

  • with all the typical files (like keybindings, settings a basic plugin file)
  • in a separate folder under /Packages/.
  • prompts for plugin_name beforehand to automatically name all files, folders and path variables (think cookiecutter here)

The inbuilt method of Sublime Text (Tools > Developer > New Plugin) will create a single plugin file in your /Packages/User/ folder. This is bad because:

  • a more complete plugin template would not only ease development (most files are already there) but also encourage best practices (like having a command file to feed the command pallet and always open Default and User settings files in parallel) leading to higher quality plugins.
  • it pollutes /Packages/User/ folder which also contains all User settings with plugin files.

While there are plugins for templating, none solves the issue described.
Can you point me to such plugin? If not do you see a need for this?

1 Like

#2

Just as a note, in Sublime a plugin is a python file that includes or modifies functionality. What you’re talking about here is a package, which contains all manner of resources.

There may or may not be a readily available package on package control that does this, but if not it would be very easy to do.

Probably a more complete solution would also have to ask you what kind of package you’re trying to make. For example, if you’re only making an event listener, then stub files for a menu or a command pallette entry are useless and arguably make things less clear rather than more.

2 Likes

#3

Indeed I see the danger that inexperienced or careless developers could abuse such plugin. If you provide a full feature plugin template with a lot of controls (menu, command palette, etc …) and logic behind it that is nonetheless not used, this could spark a lot of new plugins polluting the user experience of sublime.

So, the best way would indeed be some kind of interactive setup. Where different questions like, project name, will it use the command palette or other dependencies are prompted for. Much like the project templating engine cookiecutter.

0 Likes

#4

One could always have some kind of linter warning when commands declared in the plugins are not exposed in the command palette etc.

0 Likes

#5

PackageDev touches this area. It used to have a command that created a boilerplate package, but was sporadic and questionable in execution, which is why I purged it eventually.

In the current beta version, new resource files are created in the current project’s folder, if it is a package, so that will certainly touch one of your points. Pending proper implementation and a sane, not-too-specialized package boilerplate (maybe none at all?), I could imagine adding a command to create a new folder in the packages folder and opening that as a new project, too. Maybe open a new issue on https://github.com/SublimeText/PackageDev/issues?

2 Likes

#6

@FichteFoll Thanks, I am going to open the issue tomorrow. Maybe it is best to await how this feature of the beta release plays out before I jump head over in the development of a new plugin.

0 Likes

#7

@FichteFoll submitted: https://github.com/SublimeText/PackageDev/issues/120

1 Like