Author Topic: Using Google java format/code style?  (Read 2186 times)

edgue

  • New Community Member
  • Posts: 2
  • Hero Points: 0
Using Google java format/code style?
« on: August 17, 2018, 09:50:21 AM »
Google has various style guides for languages such as Java, C++ ( see https://github.com/google/styleguide) for details.

There are instructions how to use the style guides with IDEs like IntelliJ or eclipse.

I am simply wondering if there are pre-defined "formatter templates" for SlickEdit with google java format?

patrick

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 1818
  • Hero Points: 151
Re: Using Google java format/code style?
« Reply #1 on: August 17, 2018, 02:03:48 PM »
There isn't a predefined Google Java style that ships with SlickEdit.  I made a quick pass through section 4 of the style guide, and put together a (attached) style you can import via Tools -> Options -> Import/Export.   Once you import it, you should be able to select it as the language style in Tools -> Options -> Languages -> Application Languages -> Java -> Formatting.

The differences from the style guide:
  • There isn't a rule for spaces around the "&" in a type bounds.  We'd need to add that to the formatter.
  • We don't do the line wrapping.
  • With the exception of some rules for return/throw, we don't rewrite code.  So we don't force unbraced "if" statements to braced, or add grouping parenthesis, etc...


edgue

  • New Community Member
  • Posts: 2
  • Hero Points: 0
Re: Using Google java format/code style?
« Reply #2 on: August 20, 2018, 10:49:51 AM »
Thank you very much for the quick comeback. I appreciate your efforts!

Honestly, I find it a bit discouraging that there wasn't specific support before, but I is very nice to say how quickly you folks react.

In case our team decides to pick up the google formatter, I might provide some feedback if SlickEdit formatting will be in sync "enough" with what eclipse/intelliJ will be doing.