是否可以忽略/排除.editorconfig中的文件/文件夹?
原因:我有一个/vendor包含第三方文件的文件夹.我不希望该文件夹继承我的任何.editorconfig配置.
我找到了EditorConfig-Properties页面,似乎没有可以排除文件夹的属性.也许有一个黑客可以让它成为可能?
当前配置
root = true
[*]
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = tab
Run Code Online (Sandbox Code Playgroud)
fas*_*xes 13
IntelliJ 中有一个很棒的功能,一个月前才推出:
ij_formatter_enabled = true/false
Run Code Online (Sandbox Code Playgroud)
只需匹配您的模式或文件类型,.editorconfig匹配的资源就会被忽略:
[{**/*.sql,**/*.properties,**/File.kt}]
ij_formatter_enabled = false
Run Code Online (Sandbox Code Playgroud)
谢谢 JetBrains!
Dan*_*ail 11
@ iDev247,另一个忽略/vendor文件夹的解决方案:
none为要忽略的属性例如,如果您有:
/index.html
/vendor
/.editorconfig
Run Code Online (Sandbox Code Playgroud)
您可以匹配您vendor目录中的所有文件.editorconfig并忽略所有属性(设置为IDE的默认值):
# top-most EditorConfig file
root = true
# Ignore paths
[/vendor/**]
charset = none
end_of_line = none
insert_final_newline = none
trim_trailing_whitespace = none
indent_style = none
indent_size = none
Run Code Online (Sandbox Code Playgroud)
实际上你可以设置任何"无效"值,并且应该忽略该属性(恢复到IDE的/编辑器默认值)
更多信息:
在Node.js中,它们使用ignore值:https:
//github.com/nodejs/node/commit/d63cceeb10b7b841479a6e92d18f9fc902afda72#diff-1e70daafb475c0ce3fef7d2728279182R34
EditorConfig repo中的评论:https: //github.com/editorconfig/editorconfig/issues/262#issuecomment-230530280
您可以使用简单的行创建.editorconfig文件.vender/root = true
.editorconfig我发现的最好方法是将其添加到您要忽略的文件夹中的空白文件夹中:
[*]
generated_code = true
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
6436 次 |
| 最近记录: |