可以从 .editorconfig 到 ignore/exclude file/folder 吗?
Possible to ignore/exclude file/folder from .editorconfig?
是否可以从 .editorconfig ignore/exclude file/folder?
原因:我有一个包含第三方文件的 /vendor
文件夹。我不希望该文件夹继承我的任何 .editorconfig
配置。
我找到了 EditorConfig-Properties 页面,似乎没有 属性 来排除文件夹。也许有一个黑客让它成为可能?
当前配置
root = true
[*]
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = tab
您可以使用简单的 root = true
行在 vender/
中创建一个 .editorconfig
文件。
另一个忽略/vendor
文件夹的解决方案:
- 匹配您要忽略的路径
- 将
unset
设置为属性你想忽略
例如,如果您有:
- /index.html
- /供应商
- /.editorconfig
您可以匹配 .editorconfig
中 vendor
目录中的所有文件并忽略所有属性(设置为 IDE 的默认值):
# top-most EditorConfig file
root = true
# Ignore paths
[/vendor/**]
charset = unset
end_of_line = unset
insert_final_newline = unset
trim_trailing_whitespace = unset
indent_style = unset
indent_size = unset
在 IntelliJ 中,一个月前刚刚推出了一个很棒的功能:
ij_formatter_enabled = true/false
只需匹配您 .editorconfig
中的模式或文件类型,匹配的资源将被忽略:
[{**/*.sql,**/*.properties,**/File.kt}]
ij_formatter_enabled = false
谢谢 JetBrains!
我发现的最佳方法是将其添加到您要忽略的文件夹中的空白 .editorconfig
:
[*]
generated_code = true
是否可以从 .editorconfig ignore/exclude file/folder?
原因:我有一个包含第三方文件的 /vendor
文件夹。我不希望该文件夹继承我的任何 .editorconfig
配置。
我找到了 EditorConfig-Properties 页面,似乎没有 属性 来排除文件夹。也许有一个黑客让它成为可能?
当前配置
root = true
[*]
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = tab
您可以使用简单的 root = true
行在 vender/
中创建一个 .editorconfig
文件。
另一个忽略/vendor
文件夹的解决方案:
- 匹配您要忽略的路径
- 将
unset
设置为属性你想忽略
例如,如果您有:
- /index.html
- /供应商
- /.editorconfig
您可以匹配 .editorconfig
中 vendor
目录中的所有文件并忽略所有属性(设置为 IDE 的默认值):
# top-most EditorConfig file
root = true
# Ignore paths
[/vendor/**]
charset = unset
end_of_line = unset
insert_final_newline = unset
trim_trailing_whitespace = unset
indent_style = unset
indent_size = unset
在 IntelliJ 中,一个月前刚刚推出了一个很棒的功能:
ij_formatter_enabled = true/false
只需匹配您 .editorconfig
中的模式或文件类型,匹配的资源将被忽略:
[{**/*.sql,**/*.properties,**/File.kt}]
ij_formatter_enabled = false
谢谢 JetBrains!
我发现的最佳方法是将其添加到您要忽略的文件夹中的空白 .editorconfig
:
[*]
generated_code = true