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?
To use EditorConfig, make sure the EditorConfig plugin is enabled in the settings. Press Ctrl+Alt+S to open the IDE settings and select Plugins. Click the Installed tab. In the search field, type EditorConfig.
The EditorConfig project consists of a file format for defining coding styles and a collection of text editor plugins that enable editors to read the file format and adhere to defined styles. EditorConfig files are easily readable and they work nicely with version control systems.
From the menu bar, choose Project > Add New Item; or press Ctrl+Shift+A. Select the editorconfig File (. NET) template to add an EditorConfig file prepopulated with default . NET code style, formatting, and naming conventions.
editorconfig to GitHub or not? It depends. If the files are specific to your project, then it is appropriate to commit them. If they are appropriate for your work flow, then it is not.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With