Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to export all my Intellij code styles to a .editorconfig file?

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.

like image 494
edwise Avatar asked Mar 10 '16 12:03

edwise


People also ask

Where is .EditorConfig IntelliJ?

To use EditorConfig, make sure the EditorConfig plugin is enabled on the Settings/Preferences | Plugins page, tab Installed. See Managing plugins for details. IntelliJ IDEA allows you to manage all code style settings for each individual set of files with EditorConfig support.

How do I format all codes in IntelliJ?

In the editor, select a code fragment you want to reformat. Before reformatting, you can take a look at the code style settings that are applied to the selected code: press Alt+Enter and click Adjust code style settings. From the main menu, select Code | Reformat Code or press Ctrl+Alt+L .

What is .EditorConfig file?

EditorConfig is a simple configuration file that contains a list of rules which can be applied to any IDE's or code editors for proper formatting of code.


2 Answers

Go to "File->Settings (Preferences in OS X)->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.

above steps in image format

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.
like image 144
Pytry Avatar answered Sep 23 '22 12:09

Pytry


With later Intellijs (I'm using 2020.1), the configuration export is available via Settings -> Editor -> Code Style and then the gear icon. See the screenshot below, and the selected menu options:

enter image description here

like image 33
Brian Agnew Avatar answered Sep 25 '22 12:09

Brian Agnew