
安装 EditorConfig for VS Code 插件,该插件会自动读取项目的 .editorconfig 文件,对项目进行配置。
该文件支持属性:
- indent_style:缩进风格,可配置项:
tab,space - indent_size:缩进大小,一般设置为 4 或者 2
 - tab_width:tab 长度
 - end_of_line:控制换行类型,可配置项:
lf,cr,crlf - insert_final_newline:始终在文件末尾插入一个新行
 - trim_trailing_whitespace:去除行首的任意空白字符
 
示例:
            
            
              sh
              
              
            
          
          # http://editorconfig.org
root = true
[*] # 表示所有文件适用
charset = utf-8 # 设置文件字符集为 utf-8
indent_style = space # 缩进风格(tab | space)
indent_size = 4 # 缩进大小
end_of_line = lf # 控制换行类型(lf | cr | crlf)
trim_trailing_whitespace = true # 去除行首的任意空白字符
insert_final_newline = true # 始终在文件末尾插入一个新行
[*.md] # 表示仅 md 文件适用以下规则
max_line_length = off
trim_trailing_whitespace = false