【问题标题】:EditorConfig in Android StudioAndroid Studio 中的 EditorConfig
【发布时间】:2017-11-25 10:08:01
【问题描述】:

Android Studio 中有一个选项可以启用 EditorConfig 支持(defaultsettings->codingstyle 对话框),但不确定它是如何工作的。请告诉我如何将 .editorconfig 文件集成到 Andriod Studio 项目中?

【问题讨论】:

    标签: java android styles editorconfig


    【解决方案1】:

    EditorConfig.org 网站很好地解释了如何设置它。 Android Studio 已内置,因此无需添加插件或设置 Android Studio,只需..

    1. 在项目的根目录中添加您的.editorconfig 文件(如EditorConfig.org 所述)
    2. 启用 EditorConfig 支持(SettingsEditorCode StyleEnable 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 文件起点。
    猜你喜欢
    • 2018-05-01
    • 2017-08-01
    • 2020-08-09
    • 2023-01-02
    • 2021-03-17
    • 1970-01-01
    • 2022-12-04
    • 2020-07-10
    • 2022-12-22
    相关资源
    最近更新 更多