首页 > 解决方案 > Editorconfig 没有关于缩进的警告

问题描述

我发现了 editorconfig 但我无法让它通知我不正确的缩进。

我在 ubuntu 16.04 上安装了 editorconfig:

editorconfig -v
EditorConfig C Core Version 0.12.0

在一个目录中,我在一个.editorconfig文件中设置配置:

root = true

[*]
charset = utf-8
end_of_line = lf
indent_style = space
indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = true

然后我创建一个文本文件test.txt,仅使用 1 个空格进行缩进:

This is a test.
 It only uses one space.
I would like editorconfig to notify me.
 Because I set it to have 2 spaces.

当我运行命令时:

editorconfig $(pwd)/test.txt

我刚刚得到配置:

charset=utf-8
end_of_line=lf
indent_style=space
indent_size=2
insert_final_newline=true
trim_trailing_whitespace=true
tab_width=2

当我在 atom 中打开文件时(安装并激活了 atom editorconfig 插件),我确实在状态栏中看到了鼠标图标。它警告我有关whitespace包裹的信息。

当我停用 atomwhitespace包时,我在导航栏中看不到任何图标。

仍然在 atom 中,当我使用命令时,EditorConfig: Show State我收到一条绿色通知,告诉我一切正常。当我使用命令EditorConfig: Fix file时,我得到:

The file test.txt conformed to the end_of_line and indent_style properties. No changes were applied.

我在文档和互联网上到处查看。

我在这件事上花了大约一个小时。

我不明白。

显然缩进是不正确的。

不过,为什么我无法收到任何通知?

我显然错过了什么?

标签: ubuntu-16.04atom-editoreditorconfig

解决方案


推荐阅读