30 plugins in category «Formatting»
clang-format on the statement or selection.
This plugin does not contain
clang-format itself, you must install it separately.
clang-format is available in e.g. npm, or homebrew for Mac. This plugin also has no configuration, please use the regular
If you are using Mac OS X and have trouble getting it to run, please make sure to set your PATH environment in $HOME/.profile. Mac OS X seems to ignore $HOME/.bash_profile for applications launched from the Finder.
Solves the problem of maintaining a common code style in team environments where both IDEA and Eclipse are used.
Go to https://github.com/krasa/EclipseCodeFormatter#instructions for instructions how to use it.
Currently supports formatting of
-Java (bundled Eclipse 4.6 (requires JRE 1.8) and 4.4 libs, also emulates Eclipse's imports optimizing, configurable external Eclipse location for Eclipse 4.5+)
-C/C++ (Eclipse 4.6 (requires JRE 1.7))
-GWT (Eclipse 4.4)
Small donations are welcomed.
- Convert a string notation to a map notation
- Convert a map notation to a string notation
- Sort dependencies
- Paste a Maven dependency as a Gradle dependency
All table rows must be delimited with '|'. Line of table must start from '|' to be formatted.
Alt+Shift+E or Right click in editor area -> Format example tables
Supported delimiters: pipe, comma, tab. When formatting, any of supported delimiters are replaced with pipe.
Select text in the editor or place caret inside a table and choose action "Pipe Table" -> "Format" in Code menu or in editor popup menu.
Note that IntelliJ 13.1 added in-house support for Scala import organization, so you probably shouldn't use this plugin anymore. It still works, though.
For example, I like to align variable declarations and assignment statements like this:
int v1; // loop variable String s2; // second string public static PrintWriter p; private static boolean debugging = true; // initialize private static OutputStream outputstream = null; outputstream = new FileOutputStream(f, true); p = new DebuggingPrintWriter(outputstream, true);IDEA likes to format them with single spaces separating the syntactic elements, like this:
int v1; // loop variable String s2; // second string public static PrintWriter p; private static boolean debugging = true; // initialize private static OutputStream outputstream = null; outputstream = new FileOutputStream(f, true); p = new DebuggingPrintWriter(outputstream, true);The tabifier plugin automatically reformats the text into the first version, or any variation of it you choose.
The Tabifier is able to right justify integer literals, e.g.
public static final int ONE = 1; public static final int TWO = 2; public static final int TEN = 10; public static final int ELEVEN = 11;It can align method declaration and method call parameters, even with multiple parameters per line:
public ExpressionListParser(TokenColumn openParend, ColumnChoice params, TokenColumn closeParend, CodeStyleSettings codeStyleSettings, TabifierSettings settings, NestedParser parser, int nestingLevel)And its expression alignment is recursive, e.g.
if ((psiExpressionList.getExpressions().length > expressionListIndex && psiExpressionList.getExpressions()[expressionListIndex] == child ) || (sawNoParameters == false && expressionListIndex > 0 ) )It is capable of reformatting "if" statements as follows:
if (param1 == p3 && j > 5 ) p3 = 7; .... if (param1 == p3) p3 = 6; else if (param1 == 2 ) method1(param1, true, 3); else param1 = 7;Method calls can be reformatted to align parentheses, commas, or parameters:
align_params = (ColumnSetting ) find(ALIGN_PARAMS ); align_semicolon = (ColumnSetting ) find(ALIGN_SEMICOLON ); align_semicolon_with_comma = (BooleanSetting) find(ALIGN_SEMICOLON_WITH_COMMA);Typecast parentheses and types as well as many other expression components can also be aligned.