如何在Xcode中使用EditorConfig?配置后重新缩进不生效的问题求助
如何在Xcode中使用EditorConfig?配置后重新缩进不生效的问题求助
Xcode 16发布后,Apple新增了EditorConfig的支持,官方相关说明如下:
Added support for EditorConfig. The editor now respects indentation settings given in .editorconfig files. Xcode supports the following settings: indent_style, tab_width, indent_size, end_of_line, insert_final_newline, max_line_length, and trim_trailing_whitespace. 更多信息可查看EditorConfig相关文档。.editorconfig文件中的设置通常会优先于文件或组在「查看 > 检查器 > 文件」的「文本编辑」部分中的设置。可以通过取消勾选「Xcode > 设置 > 文本编辑」的缩进选项卡中的「优先使用EditorConfig中的设置」复选框来禁用此优先级。(20796230)
我在项目根目录创建了一个新的.editorconfig文件,内容如下:
# EditorConfig is awesome: https://EditorConfig.org # top-most EditorConfig file root = true [*] end_of_line = lf charset = utf-8 trim_trailing_whitespace = false insert_final_newline = false [*.swift] indent_style = space indent_size = 4 [*.{h, m, mm}] indent_style = space indent_size = 4 [*.metal] indent_style = space indent_size = 4
但是当我尝试重新缩进代码时,这个配置并没有生效,有没有大佬能帮忙排查下问题出在哪?
备注:内容来源于stack exchange,提问作者Hamid Yusifli
相关产品推荐
相关产品推荐

