如何在Sublime Text 2中使用JSHint smarttabs选项 [英] How to get JSHint smarttabs option working in Sublime Text 2
问题描述
我似乎无法获得Sublime Text 2 SublimeLinter软件包来停止显示混合的制表符和空格"警告.
I can't seem to get the Sublime Text 2 SublimeLinter package to stop showing the "Mixed tabs and spaces" warning.
我已经在设置中设置了"smarttabs":true,但是仍然无法使用.
I've set "smarttabs" : true in the settings, but it's still not taking.
还有其他人解决了这个问题吗?
Has anyone else solved this problem yet?
这是SublimeLinter软件包的用户设置: https://gist.github.com/3737558
Here's my user settings for the SublimeLinter package: https://gist.github.com/3737558
谢谢.
推荐答案
我解决了这样的问题.
首先不要在文件中使用混合制表符和空格.仅使用空格. Sublime可以很好地处理缩进,而无需硬制表符.
First do not use mix tabs and spaces in the files. Use spaces only. Sublime can finely handle the indentation without a hard tab character.
将Sublime Text 2设置为仅使用空格:
Setup Sublime Text 2 to use spaces only:
// Tab and whitespace handling.
// Indent using spaces, 4 spaces ber indent by default, clean up extra whitespaces on save
"tab_size": 4,
"translate_tabs_to_spaces": true,
"trim_automatic_white_space": true,
"trim_trailing_white_space_on_save": true,
// Do not try to detect the tab size from the opened file
"detect_indentation" : false,
如果遇到任何包含制表符和空格混合的旧文件,则只能从视图>缩进>将制表符转换为空格菜单将它们转换为空格.
If you encounter any old files with mixed tabs and spaces you can convert them to spaces only from View > Indentation > Convert tabs to spaces menu.
为什么制表符在源代码中不正确
Why tab character is bad in your source code
这篇关于如何在Sublime Text 2中使用JSHint smarttabs选项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!