Monday, February 17, 2014

Trim away trailing whitespace in Sublime Text 3.

JSHint is behaving differently for our team between Sumblime Text 2 and Sublime Text 3 (in spite of identical settings) on our team. Trailing whitespace in .js files is not highlighted in the later version for some reason. There is some good news however in that this explains how you may make Sublime Text 3 always trim away the trailing whitespace from a file upon a saving, and that addresses our problem in a roundabout way. A trim_trailing_white_space_on_save setting needs to end up in the file one exposes by picking the "Settings - User" option under the "Preferences" menu. My own settings file looks like so:

{
   "color_scheme": "Packages/User/Monokai (SL).tmTheme",
   "font_size": 11,
   "ignored_packages":
   [
      "Vintage",
      "SublimeLinter-jshint"
   ],
   "trim_trailing_white_space_on_save": true
}

 
 

While I am running my mouth, Trailing Spaces is a plugin for Sublime that I tried to install today to solve the same problem. This and this touch on installing plugins and this is a place to find plugins online which may be installed at the console while there is also a way to manually install a plugin and this is where you'd get the particular file to put at what is on my computer at:

C:\Users\tjaeschke\AppData\Roaming\Sublime Text 3\Installed Packages

 
 

...to install Trailing Spaces. And installed plugins will, I think, end up at what is on my laptop at:

C:\Users\tjaeschke\AppData\Roaming\Sublime Text 3\Packages

 
 

...which is a folder exposed by going to "Browse Packages..." under the "Preferences" menu. Going to "Show Console" under the "View" menu will alternatively expose the console. I tried an install at the console and a manual install and I couldn't get it to work however. Whatever.

No comments:

Post a Comment