-
Notifications
You must be signed in to change notification settings - Fork 5
Apex Formatter
Aura implements the first formatter exlusive for Apex Code for VSCode. Not only can format any Apex Code file, also you can configure to many format options to addapt the code style as you like.
To format Apex Code only need to press Alt + Shift + F
. Also can active format on save VSCode option to format the code while save any Apex Code file.
To configure the format style, Aura Helper has to many options. You can find all options into extension settings and are grouped into Class Members, Comments, Operators, Puntuation and Queries:
Format options for Apex Class and Interfaces Members. Find on: **Aurahelper > Apex Format > Class Members > [option]**
Option | Datatype | Description | Default Value |
---|---|---|---|
New Lines Between Class Fields | Number |
Add the specified new lines between class fields or constants. | 0 |
New Lines Between Code Blocke Members | Number |
Add the specified new lines between method, enums, inner classes, properties or other code block declaration on classes and interfaces. | 1 |
New Lines Between Getter And Setter Accessor | Number |
Add the specified new lines between getter and setter accessor on properties declaration. | 1 |
Single Line Properties | Boolean |
Keep property's getter and setter on a single line when getter and setter has no body. | true |
Format options for Apex Comments. Find on: **Aurahelper > Apex Format > Comment > [option]**
Option | Datatype | Description | Default Value |
---|---|---|---|
Hold After Whitespaces On Line Comment | Boolean |
Keep the after whitespaces when end comments if have any code. | false |
Hold Before Whitespaces On Line Comment | Boolean |
Keep the before whitespaces when start comments if not are on new line. | false |
New Lines Bewteen Comments | Number |
New lines between comments when have more than one comment block followed. Only apply if the comments are in different lines previous format. | 0 |
Format options for Apex Code Operators. Find on: **Aurahelper > Apex Format > Operator > [option]**
Option | Datatype | Description | Default Value |
---|---|---|---|
Add Whitespace After Open Parenthesis Operator | Boolean |
Add a white space after ( priority operator | false |
Add Whitespace After Operator | Boolean |
Add a white space after any arithmetic, logic, assignment or bitwise operator. | true |
Add Whitespace Before Close Parenthesis Operator | Boolean |
Add a white space before ) priority operator. | false |
Add Whitespace Before Operator | Boolean |
Add a white space before any arithmetic, logic, assignment or bitwise operators. | true |
Format options for Apex Code Puntuation, New Lines and Symbols like brackets. Find on: **Aurahelper > Apex Format > Puntuation > [option]**
Option | Datatype | Description | Default Value |
---|---|---|---|
Add Whitespace After Close Curly Bracket | Boolean |
Add white space after { symbol if 'Add New Line After Close Curly Bracket' is set to false | true |
Add White Space After Comma | Boolean |
Add a white space after , symbol | true |
Add Whitespace After Open Guard Parenthesis | Boolean |
Add a white space after ( symbol for flow control structures (if, else if, for, foreach, while, do...while, catch) | false |
Add Whitespace Before Close Guard Parenthesis | Boolean |
Add a white space before ( symbol for flow control structures (if, else if, for, foreach, while, do...while, catch) | true |
Add Whitespace Before Open Curly Bracket | Boolean |
Add a white space before { symbol (Not affect to List, Set or Map explicit value declaration). Only apply if Open Curly Bracket On New Line is set to false | true |
Add Whitespace Before Open Guard Parenthesis | Boolean |
Add a white space before ( symbol for flow control structures (if, else if, for, foreach, while, do...while, catch) | true |
Add Whitespace Before Open Trigger Events | Boolean |
Add a white space before ( symbol on trigger events declaration | true |
Max Blank Lines | Number |
Number of the maximum blank lines, -1 for keep the code blank lines | 5 |
Open Curly Bracket On New Line | Boolean |
Add the { symbol on a new line (Not affect to List, Set or Map explicit value declaration). | false |
Format options for SOQL Queries. Find on: **Aurahelper > Apex Format > Query > [option]**
Option | Datatype | Description | Default Value |
---|---|---|---|
Max Projection Field Per Line | Number |
Set the maximum projection fields per line. 0 to put all fields on the same line | 8 |
One Clause Per Line | Boolean |
Set every query clause on a new line | true |