Code style configuration in "config/codestyles" not working
Answered
I am using IntelliJ Ultimate 2016.1.1.
I tried using the code style configuration from Google available here: https://github.com/google/styleguide
The file in question is "intellij-java-google-style.xml".
Here is the start of the file
<code_scheme name="GoogleStyle">
<option name="JAVA_INDENT_OPTIONS">
<value>
<option name="INDENT_SIZE" value="2" />
<option name="CONTINUATION_INDENT_SIZE" value="4" />
<option name="TAB_SIZE" value="8" />
...
But after loading the file, I get Tab size 4, Indent 4, and Continuation indent 8.
What is going on?
Please sign in to leave a comment.
This code style is obsolete and is not compatible with the latest IDEA versions. Compatible IDEA code styles have .icls extension, not .xml.
Ah thank you! I thought that would be the problem.
Is there a way to convert these files?
Thanks for the prompt reply.
Sorry, I'm not aware of the way to convert it.
That's OK. I imported the Eclipse Checkstyle file instead, and it worked.
Thanks again for your help.
Hi sorry for bringing up a dead thread but would you be able to link to the file that you used to get the code style working?
@Nafees, I had the same problem.
If @Jean imported the eclipse-java-google-style.xml into IntelliJ, that eclipse file doesn't seem to contain the same settings as the intellij-java-google-style.xml. And it doesn't pass the checkstyle-6. You can do that import from Settings > Code Style > Java > Manage.
If presented with the Manage dialog, there's an option for Eclipse XML at the bottom, you can then import as new name (To:) GoogleStyle-From-Eclipse for example.
On the other hand, I forked the original styleguide and added a new style for IntelliJ 2016.1.https://github.com/jmmaranan/styleguide/commit/8ab7e20cc51419364092fa0a688751c61501ec75. And for checkstyle-6.18 it seems to pass the checks. Your setup may vary
Thanks so much, I'll double check my code with checkstyle after I'm done to make sure that it meets the criteria.
No problem. The eclipse-java-google-style XML works as it should in Eclipse Mars but it seems not when importing to IntelliJ, which ideally should be the case :)
Finally I got it:
http://stackoverflow.com/questions/42979700/how-to-configure-google-java-code-formatter-in-intellij-idea-17/42979701#42979701