How to export all my Intellij code styles to a .ed

2019-04-04 00:29发布

I'm trying to have a standard code style for my project, and I have found http://editorconfig.org/, that is a standard for that. I like it very much, and Intellij supports it (we use Intellij).

But I have read a lot and I haven´t found how I can export all my code styles of Intellij to a .editorconfig file. I only can export them to an XML that is only for Intellij.

Or is there any webpage where I can read ALL the editorconfig domain specific properties for Java? In the editorconfig github wiki they only have a few.

2条回答
倾城 Initia
2楼-- · 2019-04-04 00:59

Go to "File->Settings->Editor->Code Style". At the bottom of the right pane there is a section for Editor Config options, which now includes an "Export" button. This will only export formatting options that are available in the Editor Config specification.

To include advanced options from IDEA you will have to save IntelliJ specific files with the project.

If you want to do this without saving the entire ".idea" folder and "*.iml" files, you can also export the IDEA configuration to an xml file and save in a place where everyone can get to it.

  1. In "File->Settings->Editor->Code Style". At the top of the right pane, there will be a "Scheme" field with an dropdown of options.
  2. Next to the dropdown is a cog/gear image that will expand to give some options depending on which scheme you have selected.
  3. The two options you need are the "Export..." option and the "Import Scheme" options which do what their names imply.

Previously, on stackoverflow ...

Exporting to .editorconfig is not supported as of 2016-07-12. The current plan is to support this feature starting with IntelliJ/WebStorm version 2016.3, which is due in "late autumn".

For more info, see the YouTrack ticket for this feature request (WEB-15687).

https://youtrack.jetbrains.com/issue/WEB-15687

Edit: 2016-08-19

Here's some updated information on the EAP. According to the ticket, this feature should be available in it (have not yet tried it out).

https://confluence.jetbrains.com/plugins/servlet/mobile#content/view/78841064

Or just google "IntelliJ EAP 2016.3"

Edit: 2016-09-21

Tested it out in EAP and its working. Be aware that there's no confirmation or other indication that the file was created successfully.

I was able to install the EAP alongside my normal version, use the EAP to create the file, and then use the file in the official release.

Edit: 2016-12-21

IntelliJ IDEA 2016.3 Build #IU-163.7743.44, built on November 17, 2016

This version has the final release version for exporting .editorConfig properties.

查看更多
放我归山
3楼-- · 2019-04-04 01:04

Don't think IntelliJ will do this for you.

You'll probably have to Export IntelliJ's Code Styles as a "Code Style XML File" and then manually parse that to your EditorConfig file. Or find a parser on the internet.

To export all your Code Styles from IntelliJ:

  1. Hit "Ctrl + Alt + S".
  2. Editor > Code Style.
  3. Click the "Manage" button next to where IntelliJ states your Scheme.
  4. Export > Export as Code Style XML File.

HTH

查看更多
登录 后发表回答