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?

9 comments

That's OK. I imported the Eclipse Checkstyle file instead, and it worked.

Thanks again for your help.

1

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?

1

This code style is obsolete and is not compatible with the latest IDEA versions. Compatible IDEA code styles have .icls extension, not .xml.

0

Ah thank you! I thought that would be the problem.

Is there a way to convert these files?

 

Thanks for the prompt reply.

0

Sorry, I'm not aware of the way to convert it.

0

@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

0

Thanks so much, I'll double check my code with checkstyle after I'm done to make sure that it meets the criteria.

0

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 :)

0

Please sign in to leave a comment.