You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@geode.apache.org by Kirk Lund <kl...@pivotal.io> on 2016/06/09 17:53:16 UTC

Eclipse and IntelliJ formatters

The Eclipse formatter has now been updated to match the IntelliJ formatter
as closely as possible. Below is detailed descriptions of the changes:

1) rename Eclipse formatter Profile Name from GemFire to Geode

2) update Organize Imports to following order:

all unmatched static imports
<blank line>
java imports
<blank line>
javax imports
<blank line>
all unmatched type imports
<blank line>
batterytest.* (hydra)
<blank line>
cacheRunner.* (hydra)
<blank line>
hydra.* (hydra)
<blank line>
parReg.* (hydra)
<blank line>
perffmwk.* (hydra)
<blank line>
com.gemstone.* (geode/gemfire code)
<blank line>
com.vmware.gemfire.* (geode/gemfire code)
<blank line>
io.pivotal.geode.* (geode/gemfire code)

(each of the above groups are separated by one blank line -- this is same
as before)

The changes to the IntelliJ formatter:

1) rename IntelliJ formatter from gemfireCodeStyleScheme to
geodeCodeStyleScheme

2) update Import Layout to following order:

Import static all other imports
<blank line>
import java.*
import javax.*
<blank line>
import all other imports
<blank line>
import batterytest.*
import cacheRunner.*
import hydra.*
import parReg.*
import perffmwk.*
<blank line>
import com.gemstone.*
import com.vmware.gemfire.*
import io.pivotal.geode.*

I prefer the IntelliJ import layout, BUT I couldn't perfectly control where
the <blank lines> are inserted in the Eclipse formatter. Apparently every
block of related imports just automatically gets surrounded by a <blank
line>.

Should we import <blank line> between every block in IntelliJ to match
Eclipse?

-Kirk

Re: Eclipse and IntelliJ formatters

Posted by Bruce Schuchardt <bs...@pivotal.io>.
You're welcome Kirk - thank /you/ for fixing the problem!

Le 6/10/2016 � 9:05 AM, Kirk Lund a �crit :
> Thank you Bruce!
>
>
> On Fri, Jun 10, 2016 at 8:36 AM, Bruce Schuchardt
> <bs...@pivotal.io> wrote:
>> I've added this to the instructions on setting up Eclipse at
>> https://cwiki.apache.org/confluence/display/GEODE/Code+Style+Guide
>>
>>
>>
>> Le 6/9/2016 � 3:55 PM, Kirk Lund a �crit :
>>> eclipseOrganizeImports.importorder under Preferences | Java | Code Style |
>>> Organize Imports
>>


Re: Eclipse and IntelliJ formatters

Posted by Kirk Lund <ki...@gmail.com>.
Thank you Bruce!


On Fri, Jun 10, 2016 at 8:36 AM, Bruce Schuchardt
<bs...@pivotal.io> wrote:
> I've added this to the instructions on setting up Eclipse at
> https://cwiki.apache.org/confluence/display/GEODE/Code+Style+Guide
>
>
>
> Le 6/9/2016 à 3:55 PM, Kirk Lund a écrit :
>>
>> eclipseOrganizeImports.importorder under Preferences | Java | Code Style |
>> Organize Imports
>
>

Re: Eclipse and IntelliJ formatters

Posted by Bruce Schuchardt <bs...@pivotal.io>.
I've added this to the instructions on setting up Eclipse at 
https://cwiki.apache.org/confluence/display/GEODE/Code+Style+Guide


Le 6/9/2016 � 3:55 PM, Kirk Lund a �crit :
> eclipseOrganizeImports.importorder under Preferences | Java | Code Style |
> Organize Imports


Re: Eclipse and IntelliJ formatters

Posted by Kirk Lund <kl...@pivotal.io>.
The best common organization of imports between the two that I could come
up with is:

import statics
<blank line>
import java
<blank line>
import javax
<blank line>
import everything else
<blank line>
import com.gemfire.* (which will eventually change to org.apache.geode.*)

I updated both Eclipse and IntelliJ and experimented to confirm they both
now produce the above results. I then exported both formatters and
discovered that when Eclipse exports the Formatter xml file, it doesn't
contain the configuration for organizing imports. Under Java | Code Style |
Formatter you have to export a dedicated *.importorder file which contains
the configuration for organizing imports.

So we now have these three files under /etc:

eclipseFormatterProfile.xml
eclipseOrganizeImports.importorder
intellijIdeaCodeStyle.xml

If you want to use Eclipse, you need to import two files. Import
eclipseFormatterProfile.xml
under Preferences | Java | Code Style | Formatter by clicking Import and
then select "Apache Geode" as your Active profile. Next import
eclipseOrganizeImports.importorder under Preferences | Java | Code Style |
Organize Imports by clicking Import.

If you want to use IntelliJ, you only need to import the one file. Import
intellijIdeaCodeStyle.xml under Preferences | Java by clicking Manage and
then select "Apache Geode".
Please try this out to be sure you're using the latest configuration for
organizing imports. If you have any problems, let me know!

Thanks,
Kirk


On Thu, Jun 9, 2016 at 3:28 PM, Jens Deppe <jd...@pivotal.io> wrote:

> +1 What Bruce said.
>
> On Thu, Jun 9, 2016 at 12:24 PM, Bruce Schuchardt <bs...@pivotal.io>
> wrote:
>
> > +1
> > I have no preference but would like them to be the same
> >
> >
> > Le 6/9/2016 à 11:24 AM, Udo Kohlmeyer a écrit :
> >
> >> I really don't have a preference in regards to import formatting, as
> long
> >> as Eclipse and Intellij do the same thing.
> >>
> >> --Udo
> >>
> >>
> >> On 10/06/2016 3:54 am, Kirk Lund wrote:
> >>
> >>> Sorry this is such a mess. Please vote on how you want it to work and
> >>> then
> >>> after everyone finishes voting, I'll update both to be the same as each
> >>> other.
> >>>
> >>> -Kirk
> >>>
> >>>
> >>> On Thu, Jun 9, 2016 at 10:53 AM, Kirk Lund <kl...@pivotal.io> wrote:
> >>>
> >>> The Eclipse formatter has now been updated to match the IntelliJ
> >>>> formatter
> >>>> as closely as possible. Below is detailed descriptions of the changes:
> >>>>
> >>>> 1) rename Eclipse formatter Profile Name from GemFire to Geode
> >>>>
> >>>> 2) update Organize Imports to following order:
> >>>>
> >>>> all unmatched static imports
> >>>> <blank line>
> >>>> java imports
> >>>> <blank line>
> >>>> javax imports
> >>>> <blank line>
> >>>> all unmatched type imports
> >>>> <blank line>
> >>>> batterytest.* (hydra)
> >>>> <blank line>
> >>>> cacheRunner.* (hydra)
> >>>> <blank line>
> >>>> hydra.* (hydra)
> >>>> <blank line>
> >>>> parReg.* (hydra)
> >>>> <blank line>
> >>>> perffmwk.* (hydra)
> >>>> <blank line>
> >>>> com.gemstone.* (geode/gemfire code)
> >>>> <blank line>
> >>>> com.vmware.gemfire.* (geode/gemfire code)
> >>>> <blank line>
> >>>> io.pivotal.geode.* (geode/gemfire code)
> >>>>
> >>>> (each of the above groups are separated by one blank line -- this is
> >>>> same
> >>>> as before)
> >>>>
> >>>> The changes to the IntelliJ formatter:
> >>>>
> >>>> 1) rename IntelliJ formatter from gemfireCodeStyleScheme to
> >>>> geodeCodeStyleScheme
> >>>>
> >>>> 2) update Import Layout to following order:
> >>>>
> >>>> Import static all other imports
> >>>> <blank line>
> >>>> import java.*
> >>>> import javax.*
> >>>> <blank line>
> >>>> import all other imports
> >>>> <blank line>
> >>>> import batterytest.*
> >>>> import cacheRunner.*
> >>>> import hydra.*
> >>>> import parReg.*
> >>>> import perffmwk.*
> >>>> <blank line>
> >>>> import com.gemstone.*
> >>>> import com.vmware.gemfire.*
> >>>> import io.pivotal.geode.*
> >>>>
> >>>> I prefer the IntelliJ import layout, BUT I couldn't perfectly control
> >>>> where the <blank lines> are inserted in the Eclipse formatter.
> >>>> Apparently
> >>>> every block of related imports just automatically gets surrounded by a
> >>>> <blank line>.
> >>>>
> >>>> Should we import <blank line> between every block in IntelliJ to match
> >>>> Eclipse?
> >>>>
> >>>> -Kirk
> >>>>
> >>>>
> >>>>
> >>
> >
>

Re: Eclipse and IntelliJ formatters

Posted by Jens Deppe <jd...@pivotal.io>.
+1 What Bruce said.

On Thu, Jun 9, 2016 at 12:24 PM, Bruce Schuchardt <bs...@pivotal.io>
wrote:

> +1
> I have no preference but would like them to be the same
>
>
> Le 6/9/2016 à 11:24 AM, Udo Kohlmeyer a écrit :
>
>> I really don't have a preference in regards to import formatting, as long
>> as Eclipse and Intellij do the same thing.
>>
>> --Udo
>>
>>
>> On 10/06/2016 3:54 am, Kirk Lund wrote:
>>
>>> Sorry this is such a mess. Please vote on how you want it to work and
>>> then
>>> after everyone finishes voting, I'll update both to be the same as each
>>> other.
>>>
>>> -Kirk
>>>
>>>
>>> On Thu, Jun 9, 2016 at 10:53 AM, Kirk Lund <kl...@pivotal.io> wrote:
>>>
>>> The Eclipse formatter has now been updated to match the IntelliJ
>>>> formatter
>>>> as closely as possible. Below is detailed descriptions of the changes:
>>>>
>>>> 1) rename Eclipse formatter Profile Name from GemFire to Geode
>>>>
>>>> 2) update Organize Imports to following order:
>>>>
>>>> all unmatched static imports
>>>> <blank line>
>>>> java imports
>>>> <blank line>
>>>> javax imports
>>>> <blank line>
>>>> all unmatched type imports
>>>> <blank line>
>>>> batterytest.* (hydra)
>>>> <blank line>
>>>> cacheRunner.* (hydra)
>>>> <blank line>
>>>> hydra.* (hydra)
>>>> <blank line>
>>>> parReg.* (hydra)
>>>> <blank line>
>>>> perffmwk.* (hydra)
>>>> <blank line>
>>>> com.gemstone.* (geode/gemfire code)
>>>> <blank line>
>>>> com.vmware.gemfire.* (geode/gemfire code)
>>>> <blank line>
>>>> io.pivotal.geode.* (geode/gemfire code)
>>>>
>>>> (each of the above groups are separated by one blank line -- this is
>>>> same
>>>> as before)
>>>>
>>>> The changes to the IntelliJ formatter:
>>>>
>>>> 1) rename IntelliJ formatter from gemfireCodeStyleScheme to
>>>> geodeCodeStyleScheme
>>>>
>>>> 2) update Import Layout to following order:
>>>>
>>>> Import static all other imports
>>>> <blank line>
>>>> import java.*
>>>> import javax.*
>>>> <blank line>
>>>> import all other imports
>>>> <blank line>
>>>> import batterytest.*
>>>> import cacheRunner.*
>>>> import hydra.*
>>>> import parReg.*
>>>> import perffmwk.*
>>>> <blank line>
>>>> import com.gemstone.*
>>>> import com.vmware.gemfire.*
>>>> import io.pivotal.geode.*
>>>>
>>>> I prefer the IntelliJ import layout, BUT I couldn't perfectly control
>>>> where the <blank lines> are inserted in the Eclipse formatter.
>>>> Apparently
>>>> every block of related imports just automatically gets surrounded by a
>>>> <blank line>.
>>>>
>>>> Should we import <blank line> between every block in IntelliJ to match
>>>> Eclipse?
>>>>
>>>> -Kirk
>>>>
>>>>
>>>>
>>
>

Re: Eclipse and IntelliJ formatters

Posted by Bruce Schuchardt <bs...@pivotal.io>.
+1
I have no preference but would like them to be the same

Le 6/9/2016 � 11:24 AM, Udo Kohlmeyer a �crit :
> I really don't have a preference in regards to import formatting, as 
> long as Eclipse and Intellij do the same thing.
>
> --Udo
>
>
> On 10/06/2016 3:54 am, Kirk Lund wrote:
>> Sorry this is such a mess. Please vote on how you want it to work and 
>> then
>> after everyone finishes voting, I'll update both to be the same as each
>> other.
>>
>> -Kirk
>>
>>
>> On Thu, Jun 9, 2016 at 10:53 AM, Kirk Lund <kl...@pivotal.io> wrote:
>>
>>> The Eclipse formatter has now been updated to match the IntelliJ 
>>> formatter
>>> as closely as possible. Below is detailed descriptions of the changes:
>>>
>>> 1) rename Eclipse formatter Profile Name from GemFire to Geode
>>>
>>> 2) update Organize Imports to following order:
>>>
>>> all unmatched static imports
>>> <blank line>
>>> java imports
>>> <blank line>
>>> javax imports
>>> <blank line>
>>> all unmatched type imports
>>> <blank line>
>>> batterytest.* (hydra)
>>> <blank line>
>>> cacheRunner.* (hydra)
>>> <blank line>
>>> hydra.* (hydra)
>>> <blank line>
>>> parReg.* (hydra)
>>> <blank line>
>>> perffmwk.* (hydra)
>>> <blank line>
>>> com.gemstone.* (geode/gemfire code)
>>> <blank line>
>>> com.vmware.gemfire.* (geode/gemfire code)
>>> <blank line>
>>> io.pivotal.geode.* (geode/gemfire code)
>>>
>>> (each of the above groups are separated by one blank line -- this is 
>>> same
>>> as before)
>>>
>>> The changes to the IntelliJ formatter:
>>>
>>> 1) rename IntelliJ formatter from gemfireCodeStyleScheme to
>>> geodeCodeStyleScheme
>>>
>>> 2) update Import Layout to following order:
>>>
>>> Import static all other imports
>>> <blank line>
>>> import java.*
>>> import javax.*
>>> <blank line>
>>> import all other imports
>>> <blank line>
>>> import batterytest.*
>>> import cacheRunner.*
>>> import hydra.*
>>> import parReg.*
>>> import perffmwk.*
>>> <blank line>
>>> import com.gemstone.*
>>> import com.vmware.gemfire.*
>>> import io.pivotal.geode.*
>>>
>>> I prefer the IntelliJ import layout, BUT I couldn't perfectly control
>>> where the <blank lines> are inserted in the Eclipse formatter. 
>>> Apparently
>>> every block of related imports just automatically gets surrounded by a
>>> <blank line>.
>>>
>>> Should we import <blank line> between every block in IntelliJ to match
>>> Eclipse?
>>>
>>> -Kirk
>>>
>>>
>


Re: Eclipse and IntelliJ formatters

Posted by Kirk Lund <kl...@pivotal.io>.
Ideally we would want to group static all together, other (non-GemFire
related) all together and then all GemFire related together. Because of 1)
the mix of hydra packages and 2) com.vmware.gemfire & io.pivotal.geode we
can only group GemFire related together in IntelliJ (we can't do this in
Eclipse).

In order to support Eclipse and IntelliJ, we are left with only two options:

1) insert <blank line> between every block in the IntelliJ import layout
(which gives us a pretty weird ordering in my opinion)

or

2) give up and just alphabetize everything in one giant block that's only
separated from the static imports

Preferences?

-Kirk


On Thu, Jun 9, 2016 at 11:24 AM, Udo Kohlmeyer <uk...@pivotal.io>
wrote:

> I really don't have a preference in regards to import formatting, as long
> as Eclipse and Intellij do the same thing.
>
> --Udo
>
>
>
> On 10/06/2016 3:54 am, Kirk Lund wrote:
>
>> Sorry this is such a mess. Please vote on how you want it to work and then
>> after everyone finishes voting, I'll update both to be the same as each
>> other.
>>
>> -Kirk
>>
>>
>> On Thu, Jun 9, 2016 at 10:53 AM, Kirk Lund <kl...@pivotal.io> wrote:
>>
>> The Eclipse formatter has now been updated to match the IntelliJ formatter
>>> as closely as possible. Below is detailed descriptions of the changes:
>>>
>>> 1) rename Eclipse formatter Profile Name from GemFire to Geode
>>>
>>> 2) update Organize Imports to following order:
>>>
>>> all unmatched static imports
>>> <blank line>
>>> java imports
>>> <blank line>
>>> javax imports
>>> <blank line>
>>> all unmatched type imports
>>> <blank line>
>>> batterytest.* (hydra)
>>> <blank line>
>>> cacheRunner.* (hydra)
>>> <blank line>
>>> hydra.* (hydra)
>>> <blank line>
>>> parReg.* (hydra)
>>> <blank line>
>>> perffmwk.* (hydra)
>>> <blank line>
>>> com.gemstone.* (geode/gemfire code)
>>> <blank line>
>>> com.vmware.gemfire.* (geode/gemfire code)
>>> <blank line>
>>> io.pivotal.geode.* (geode/gemfire code)
>>>
>>> (each of the above groups are separated by one blank line -- this is same
>>> as before)
>>>
>>> The changes to the IntelliJ formatter:
>>>
>>> 1) rename IntelliJ formatter from gemfireCodeStyleScheme to
>>> geodeCodeStyleScheme
>>>
>>> 2) update Import Layout to following order:
>>>
>>> Import static all other imports
>>> <blank line>
>>> import java.*
>>> import javax.*
>>> <blank line>
>>> import all other imports
>>> <blank line>
>>> import batterytest.*
>>> import cacheRunner.*
>>> import hydra.*
>>> import parReg.*
>>> import perffmwk.*
>>> <blank line>
>>> import com.gemstone.*
>>> import com.vmware.gemfire.*
>>> import io.pivotal.geode.*
>>>
>>> I prefer the IntelliJ import layout, BUT I couldn't perfectly control
>>> where the <blank lines> are inserted in the Eclipse formatter. Apparently
>>> every block of related imports just automatically gets surrounded by a
>>> <blank line>.
>>>
>>> Should we import <blank line> between every block in IntelliJ to match
>>> Eclipse?
>>>
>>> -Kirk
>>>
>>>
>>>
>

Re: Eclipse and IntelliJ formatters

Posted by Udo Kohlmeyer <uk...@pivotal.io>.
I really don't have a preference in regards to import formatting, as 
long as Eclipse and Intellij do the same thing.

--Udo


On 10/06/2016 3:54 am, Kirk Lund wrote:
> Sorry this is such a mess. Please vote on how you want it to work and then
> after everyone finishes voting, I'll update both to be the same as each
> other.
>
> -Kirk
>
>
> On Thu, Jun 9, 2016 at 10:53 AM, Kirk Lund <kl...@pivotal.io> wrote:
>
>> The Eclipse formatter has now been updated to match the IntelliJ formatter
>> as closely as possible. Below is detailed descriptions of the changes:
>>
>> 1) rename Eclipse formatter Profile Name from GemFire to Geode
>>
>> 2) update Organize Imports to following order:
>>
>> all unmatched static imports
>> <blank line>
>> java imports
>> <blank line>
>> javax imports
>> <blank line>
>> all unmatched type imports
>> <blank line>
>> batterytest.* (hydra)
>> <blank line>
>> cacheRunner.* (hydra)
>> <blank line>
>> hydra.* (hydra)
>> <blank line>
>> parReg.* (hydra)
>> <blank line>
>> perffmwk.* (hydra)
>> <blank line>
>> com.gemstone.* (geode/gemfire code)
>> <blank line>
>> com.vmware.gemfire.* (geode/gemfire code)
>> <blank line>
>> io.pivotal.geode.* (geode/gemfire code)
>>
>> (each of the above groups are separated by one blank line -- this is same
>> as before)
>>
>> The changes to the IntelliJ formatter:
>>
>> 1) rename IntelliJ formatter from gemfireCodeStyleScheme to
>> geodeCodeStyleScheme
>>
>> 2) update Import Layout to following order:
>>
>> Import static all other imports
>> <blank line>
>> import java.*
>> import javax.*
>> <blank line>
>> import all other imports
>> <blank line>
>> import batterytest.*
>> import cacheRunner.*
>> import hydra.*
>> import parReg.*
>> import perffmwk.*
>> <blank line>
>> import com.gemstone.*
>> import com.vmware.gemfire.*
>> import io.pivotal.geode.*
>>
>> I prefer the IntelliJ import layout, BUT I couldn't perfectly control
>> where the <blank lines> are inserted in the Eclipse formatter. Apparently
>> every block of related imports just automatically gets surrounded by a
>> <blank line>.
>>
>> Should we import <blank line> between every block in IntelliJ to match
>> Eclipse?
>>
>> -Kirk
>>
>>


Re: Eclipse and IntelliJ formatters

Posted by Kirk Lund <kl...@pivotal.io>.
Sorry this is such a mess. Please vote on how you want it to work and then
after everyone finishes voting, I'll update both to be the same as each
other.

-Kirk


On Thu, Jun 9, 2016 at 10:53 AM, Kirk Lund <kl...@pivotal.io> wrote:

> The Eclipse formatter has now been updated to match the IntelliJ formatter
> as closely as possible. Below is detailed descriptions of the changes:
>
> 1) rename Eclipse formatter Profile Name from GemFire to Geode
>
> 2) update Organize Imports to following order:
>
> all unmatched static imports
> <blank line>
> java imports
> <blank line>
> javax imports
> <blank line>
> all unmatched type imports
> <blank line>
> batterytest.* (hydra)
> <blank line>
> cacheRunner.* (hydra)
> <blank line>
> hydra.* (hydra)
> <blank line>
> parReg.* (hydra)
> <blank line>
> perffmwk.* (hydra)
> <blank line>
> com.gemstone.* (geode/gemfire code)
> <blank line>
> com.vmware.gemfire.* (geode/gemfire code)
> <blank line>
> io.pivotal.geode.* (geode/gemfire code)
>
> (each of the above groups are separated by one blank line -- this is same
> as before)
>
> The changes to the IntelliJ formatter:
>
> 1) rename IntelliJ formatter from gemfireCodeStyleScheme to
> geodeCodeStyleScheme
>
> 2) update Import Layout to following order:
>
> Import static all other imports
> <blank line>
> import java.*
> import javax.*
> <blank line>
> import all other imports
> <blank line>
> import batterytest.*
> import cacheRunner.*
> import hydra.*
> import parReg.*
> import perffmwk.*
> <blank line>
> import com.gemstone.*
> import com.vmware.gemfire.*
> import io.pivotal.geode.*
>
> I prefer the IntelliJ import layout, BUT I couldn't perfectly control
> where the <blank lines> are inserted in the Eclipse formatter. Apparently
> every block of related imports just automatically gets surrounded by a
> <blank line>.
>
> Should we import <blank line> between every block in IntelliJ to match
> Eclipse?
>
> -Kirk
>
>