Reputation: 565
There is an option in Android studio to enable EditorConfig support( defaultsettings->codingstyle dialog),but not sure how it works.Could you please let me know how to integrate .editorconfig file in the Andriod Studio project?
Upvotes: 23
Views: 12515
Reputation: 3920
The website EditorConfig.org has a good explanation of how to get it set up. Android Studio has it built-in so there should be no need to add a plugin or set up Android Studio, just..
.editorconfig
file in the root directory of the project (as mentioned at EditorConfig.org)Settings
→ Editor
→ Code Style
→ Enable EditorConfig support
)A search for .editorconfig files will stop if the root filepath is reached or an EditorConfig file with root=true is found.
I would recommend starting with something along these lines, and tweaking it as your team sees fit:
# indicate this is the root of the project
root = true
[*.{kt,java,xml,gradle,md}]
charset = utf-8
indent_style = space
indent_size = 4
trim_trailing_whitespace = true
insert_final_newline = true
end_of_line = lf
Upvotes: 39