Java code style - align question

Hi,

I am fighting with align/wrap configuration for java code style. I have a following code:

   return select().from(quota).where(quota.hierarchyType.eq(QuotaHierarchyType.CHILD_DEFAULT).and(quota.parentOrgItemId.eq(id.getId()))).list(quota);


I would like to have following format (I do it manually):

   return select().from(quota)
               .where(quota.hierarchyType.eq(QuotaHierarchyType.CHILD_DEFAULT)
               .and(quota.parentOrgItemId.eq(id.getId())))
               .list(quota);


But whenever I reformat that file (by idea java formatter), idea will toch also this block and reformats it to:

   return select().from(quota)
               .where(quota.hierarchyType.eq(QuotaHierarchyType.CHILD_DEFAULT)
                         .and(quota.parentOrgItemId.eq(id.getId())))
               .list(quota);



How to configure code style not to touch my formatting ( indent ".and(..." ) in such code block?

Thx.

Dusan
1 comment
Comment actions Permalink

You can slap a pair of markers to prevent IDEA from reformatting your fragment of code, like this:

// @formatter:off
whatever.formatting.
     you.would
          .like.to.have;
// @formatter:on

, altough it is more of a dodging the problem than solving it the right way.
Just make sure formatting markers are enabled in Code Style > General > Formatter Control.

0

Please sign in to leave a comment.