Storing code style in project, in Ultimate 2021.1
Answered
I'm trying to save a code style in our project so that it can be stored in version control, and automatically used by other developers. I've saved the file to `.idea/codeStyles/Project.xml`, and created the file `.idea/codeStyles/codeStyleConfig.xml` with `<option name="USE_PER_PROJECT_SETTINGS" value="true" />`.
As far as I can tell, this ought to result in these code style settings being applied when IntelliJ imports the project, but this doesn't happen.
In case it matters, we are using the Gradle IntelliJ plugin (gradle-idea-ext-plugin), but we aren't configuring code style with that.
Please sign in to leave a comment.
Hello,
To share IDE settings across team members I'd recommend you configure Settings Repository instead of manually changing the .idea directory. Please see https://www.jetbrains.com/help/idea/sharing-your-ide-settings.html#f3f211a9 .
The settings you can sync include IDE themes, keymaps, color schemes, system settings, UI settings, menus and toolbars settings, project view settings, editor settings, code completion settings, parameter name hints, live templates, code styles, and the list of enabled and disabled plugins.
Thank you for your suggestion. The documentation suggests using a private repository, but the project in question here has external contributors, and I would like them to be able to configure their IDE the same as employees. Is there any risk with having the settings repository publicly readable?
I discovered that I can do what I needed using our `.editorconfig` file. I found all the information I needed in this blog post:
https://blog.jetbrains.com/idea/2019/06/managing-code-style-on-a-directory-level-with-editorconfig/
Particularly in the comments: