【发布时间】:2017-11-25 10:08:01
【问题描述】:
Android Studio 中有一个选项可以启用 EditorConfig 支持(defaultsettings->codingstyle 对话框),但不确定它是如何工作的。请告诉我如何将 .editorconfig 文件集成到 Andriod Studio 项目中?
【问题讨论】:
标签: java android styles editorconfig
Android Studio 中有一个选项可以启用 EditorConfig 支持(defaultsettings->codingstyle 对话框),但不确定它是如何工作的。请告诉我如何将 .editorconfig 文件集成到 Andriod Studio 项目中?
【问题讨论】:
标签: java android styles editorconfig
EditorConfig.org 网站很好地解释了如何设置它。 Android Studio 已内置,因此无需添加插件或设置 Android Studio,只需..
.editorconfig 文件(如EditorConfig.org 所述)Settings → Editor → Code Style → Enable EditorConfig support)如果到达根文件路径或找到具有 root=true 的 EditorConfig 文件,将停止搜索 .editorconfig 文件。
我建议从这些方面开始,并根据您的团队认为合适的方式对其进行调整:
# 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
【讨论】:
.editorconfig 文件起点。