Installing and using the IntelliJ Plugin
To use the Buck Intellij Plugin you will have to install Buck, by following the guide from Downloading and Installing Buck.
Installing the plugin
You can download the plugin from here or manually build it by following the guide from Building the Buck Intellij Plugin. After that, you can install it by following the Installing a Plugin from Disk guide.Using the plugin
After you have installed it, you can view the Buck Plugin Tool Window by accessing View > Tool Windows > Buck
.
Utility Functions
- Buck Code Completion
Helps you complete the names of keywords and buck rule names within the visibility scope.
- Go to Buck File
Jump to the BUCK file of current source file. To access it you can:
Tools > Buck > Go to Buck file
Right click > Buck > Go to Buck file
⇧ + ⌘ + P
- Go to Buck Dependencies
Quickly jump to other BUCK files with
⌘ + Click
or⌘ + B
. - Reformat BUCK files
The Buck Plugin lets you reformat source code to meet the requirements of your code style. The plugin also supports customized spacing and indenting in the buck code style settings. You can access it by going to
Code > Reformat Code
or by pressing⌥ + ⌘ + L
. - Sort buck dependencies
You can access it by going to
Code > Optimise Imports
or by pressing^ + ⌥ + O
. - Automatically Convert to Buck Dependencies after Paste in BUCK file
For example:
- "import com.example.activity.MyFirstActivity" -> "//java/com/example/activity:activity"
- "package com.example.activity;" -> "//java/com/example/activity:activity"
- "com.example.activity.MyFirstActivity" -> "//java/com/example/activity:activity"
- Error Annotation
If a Buck dependency does not exist, it will be marked with red.
- Commenting and Uncommenting
You can comment or uncomment selected lines of a BUCK file by accessing
Code > Comment with Line Comment
or by pressing⌘ + /
.
Executing Buck Commands
- Select target
Before you start doing any of the below mentioned actions you will have to select a buck target.
You can start selecting the buck target either by pressing the associated icon from the Buck Plugin tool window or by using
⇧ + ⌘ + J
.If you have an alias, you can just search for it. If you don't have an alias you have to write the whole path to the BUCK file. Once you are at the directory with the BUCK file, the plugin will search for all the available targets, which may take some time.
You can use autocomplete by pressing → and navigate through the search by pressing ↑ and ↓. - Build target
Once you selected the target you can start a buck build either by pressing the associated icon from the Buck Plugin tool window or by using
⇧ + ⌘ + S
. - Show Buck/compiler errors and easily go through them
When building, you may receive compiler errors. You can easily navigate through them and on double click you will be sent to the appropriate column and line.
- Install target
Once you selected the target you can start a buck install either by pressing the associated icon from the Buck Plugin tool window or by using
⇧ + ⌘ + X
. - Uninstall target
Once you selected the target you can start a buck uninstall either by pressing the associated icon from the Buck Plugin tool window or by using
⇧ + ⌘ + M
. - Test target
Once you selected the target you can start a buck test either by pressing the associated icon from the Buck Plugin tool window or by using
⇧ + ⌘ + Y
. - Buck project target
Once you selected the target you can start a buck project either by pressing the associated icon from the Buck Plugin tool window or by using
⇧ + ⌘ + B
. - Buck kill
Once you started one of the above mentioned actions you can stop it either by pressing the associated icon from the Buck Plugin tool window or by using
⇧ + ⌘ + L
.
Settings
- Buck Settings
You can set your buck executable path and other install settings by going to
Preferences > Tools > Buck
. - Code Style Settings
You can set code style settings by going to
Preferences > Editor > Code Style > Buck
. - Colors & Font Settings
You can set the syntax highlighting colors from
Preferences > Editor > Colors & Fonts > Buck
.