Sublime Forum

BuildParts (execute or build part of your code)

#1

A new package which allow you to execute or build part of your code.

github.com/erinata/BuildParts

This package has only one command “BuildParts: Build(or execute) the selected code”

When you run this command, it will build the code that you have selected using the build system selected by Sublime Text. If you have selected nothing, it will build the whole file.

BuildParts default keybindings are “ctrl+b” (for Windows and Linux) and “super+b” (for Mac). It’s the same as the default keybinding for building your code. If you want to invoke the build system for the whole file. Just select nothing and press “ctrl+b”.

Example:

Suppose you have a document named “testing.rb”

Puts("Hello") Puts("World") Puts("Everyone")

If you select nothing and press “ctrl+b”, Sublime Text will build the whole file and the build output console will show:

Hello World Everyone

Suppose you select the first 2 lines, and press “ctrl+b”, Sublime Text will only build the current selected parts and the build output console will show:

Hello World

As BuildPart utilizes the build system in Sublime Text, it supports any language the Sublime Text can build. It also work with custom build systems that are install via packages.

1 Like

Execute programs with parameters from text line?
#2

Now BuildParts is limited to using the build system chosen by Sublime text automatically.

It would be super helpful if someone can tell me

  1. how to get the “currently chosen build system” via API , and also
  2. how to specify a build system when using run_command(“build”)

so that I can allow the user to choose whatever build systems to build the code.

0 Likes

#3

Thanks for making this package - just what I was looking for!

Unfortunately it crashes Sublime for me. I’m running Linux (Kubuntu 12.04) with the latest stable Sublime Text 2. I’m not sure what useful debug output there might be.

Behaviour to reproduce is: Create a Ruby file with .rb extension. Select some text and press Ctrl+b - Sublime instantly crashes and either freezes or closes down completely.

0 Likes