-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Code Style
Tim Molter edited this page Apr 15, 2017
·
8 revisions
In 2014, a vote was held to determine what the general preference was regarding the code format of XChange. After determining what code format to go with the second challenge was to create compatible code formatting profiles for the different IDEs.
The resulting formatting profiles for the different IDEs can be found in xchange-parent/etc
.
If you would like to contribute a format profile for an IDE not yet available, it would be greatly appreciated. If you find any inconsistencies, please either mention them in the above referenced issue or submit a patch to the formatting profile directly.
The main code formatting aspects are as follows:
Style | Value |
---|---|
Indentation | 2 spaces |
Max empty lines | 1 |
Line after method declaration | minimum of zero |
import ordering | static, java, javax, org, com, other |
import spacing | spaces between import groups |
line length | 150 columns |
line breaks | Unix (\n) |
Continuation indent | 4 |
Import in same package to collapse import statement | 99 |
In Idea, set formatter in Preferences - > Editor -> Code Style - > Java to XChange_Idea_2017_04.xml
.
<title>gfg</title>
<style type=text/css>
p{
background-color:gray;
margin: 10px;
}
div
{
color: white;
background-color: 009900;
margin: 2px;
font-size: 25px;
}
span
{
color: black;
background-color: gray;
margin: 5px;
font-size: 25px;
}
</style>
<div> div tag </div>
<div> div tag </div>
<div> div tag </div>
<div> div tag </div>
<span>span-tag</span>
<span>span-tag</span>
<span>span-tag</span>
<span>span-tag</span>