问题
I can't seem to get the Sublime Text 2 SublimeLinter package to stop showing the "Mixed tabs and spaces" warning.
I've set "smarttabs" : true in the settings, but it's still not taking.
Has anyone else solved this problem yet?
Here's my user settings for the SublimeLinter package: https://gist.github.com/3737558
Thanks.
回答1:
I solve the problem like this.
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.
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
- http://opensourcehacker.com/2012/05/13/never-use-hard-tabs/
回答2:
i have the same problem, maybe i found the reason
the smarttabs
options can control the warning when space after tab, but can't control the warning tabs after the space, you can try it
if you want to disable the warning you can add a comment at top top of the file
/*jshint -W099*/
来源:https://stackoverflow.com/questions/12461291/how-to-get-jshint-smarttabs-option-working-in-sublime-text-2