Build System should allow Run, Test, Verify, Preview, etc.

Alex Chaffee 10 år siden opdateret af Mikel Ward 9 år siden 1

I've just been using ST for a few hours but it occurs to me that some plugins (notably RubyTest) are bending over backwards to do things that maybe should be provided by the existing Build System architecture.

If Build Systems could provide more that just one "cmd" then each file type could have its own system for doing a whole panoply of common tasks:

* Build (as currently defined) 

* Run (build and execute) 

* Verify ("lint" for .c, "ruby -cw" for .rb, http://validator.w3.org/check for .html)

* Preview (turn the file from Markdown etc. into HTML, then launch a browser)

* Test (for foo.rb, open and run foo_test.rb)

The above is probably overspecified, but think about what it would take to have a common system at least for "Build/Run/Preview". Then every file type would have the same key command and menu option for these common tasks.

It looks like it does now, albeit not out of the box.

See the Variants section of the Build Systems documentation.

For example, here's my new .config/sublime-text-2/Packages/Makefile with Test and Run commands added:


"cmd": ["make"],

"file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",

"working_dir": "${project_path:${folder:${file_path}}}",

"selector": "source.makefile",




"name": "Clean",

"cmd": ["make", "clean"]



            "name": "Test",

            "cmd": ["make", "test"]



            "name": "Run",

            "cmd": ["make", "run"]




And then add some key bindings:


    { "keys": ["ctrl+r"], "command": "build", "args": {"variant": "Run"} },

    { "keys": ["ctrl+t"], "command": "build", "args": {"variant": "Test"} }


Kundesupport af UserEcho