Integrate FormatCode Into IntelliJ IDEA

Format Source Code within IntelliJ IDEA

The following instructions allow you to format and beautify the current open Java source code file in IntelliJ IDEA Java IDE using FormatCode command line tool. We used a free trial version of IntelliJ IDEA Version 3.0, so if you use an older or even a newer version then several screenshots or menu items may differ from our description.

Add a Tool Menu that will invoke FormatCode

1. Click "Options" -> "External Tools".

2. Click "Add..." button, then click "External Tools".

3. Please fill in the form as show below: (Assuming you installed FormatCode in C:\Program Files\FormatCode\)

  • Name:                    FormatCode
  • Description:            Format Current File With FormatCode
  • Program:                C:\Program Files\FormatCode\FormatCode.exe
  • Parameters:            "$FilePath$"
  • Working Directory:   C:\Program Files\FormatCode\

4. Click "OK" button to save settings.

Add a keymapping so you can invoke FormatCode using Ctrl+T

1. Click "Options" -> "Keymap".

2. Click the default keymap, then press "Copy". Name your new keymap something like My Keymap.

3. In the "Action" column, expand the External Tools tree node, select the "Shortcuts" cell in the "FormatCode" row.

4. Then, please define your keymap as show below:

You may now invoke FormatCode command line tool by two ways:

1. Using Ctrl+T

2. By clicking "Tools" -> "FormatCode".

With FormatCode Code Formatters, you can format and transform any foreign source code to meet your favourite coding style within IntelliJ IDEA in several seconds!


C/C++ Formatter

Java Formatter

C# Formatter

VB Formatter

VB.NET Formatter

PHP Formatter

ASP Formatter

VBScript Formatter

JavaScript Formatter

Delphi Formatter

Asm x86 Formatter

Asm 51 Formatter