Validate On Save
- Switching to your browser (or attempting to compile/run).
- Finding out you had a syntax error in your source code.
- Switching back to TextMate.
- Fixing the error.
- Switching back to the browser.
This bundle lets you skips several of those steps.
- Bash (optionally using Shellcheck)
- Erlang (possibly buggy, compiles *.beam file using erlc)
- Python (using PyFlakes)
- Ruby (optionally using Rubocop)
- Sass/Compass (still a bit buggy)
Follow these instructions if you have Git installed:
mkdir -p ~/Library/Application\ Support/TextMate/Bundles/; #just in case you are missing the folder cd ~/Library/Application\ Support/TextMate/Bundles/; git clone git://github.com/sxtxixtxcxh/validate-on-save.tmbundle.git "Validate On Save.tmbundle"; osascript -e 'tell app "TextMate" to reload bundles';
Installing via Git will allow you to keep up to date with the
Validate On Save >
Update Bundle menu command.
If you don't have Git and downloaded this from Github (really? you don't have Git?), after you've unzipped or untarred, you'll have to rename the folder from
Validate On Save.tmbundle. Double click and TextMate should install it for you.
You can customize how and when VOS (Validate On Save) notifies you. This is done by setting Shell Variables in TextMate (
Shell Variables). All variables starting with
VOS_ take values of either "true" or "false".
VOS_VALIDATOR_INFO: Outputs information about the validator. (defaults to "false")
VOS_ONLY_ON_ERROR: Only displays notifications on syntax error. Useful if you don't want to be told repeatedly that everything is OK. (defaults to "false")
VOS_TM_NOTIFY: Display the validation result in a TextMate tooltip. If you use Growl, you might want to disable this. (defaults to "true")
VOS_GROWL: Use Growl to display the validation result. (defaults to "false")
VOS_JUMP_TO_ERROR: When a error is found, automatically move the cursor to the line causing the problem. (defaults to "false")
VOS_TRIM_LINES: Remove trailing whitespaces from non-empty lines (defaults to "true")
VOS_TRIM_DOCUMENT: Remove trailing whitespaces and new lines from end of document (defaults to "false")
VOS_ERL_OUTPUT_TO_TMP: When validating Erlang, the
.erlfile you are working on needs to be compiled to a
.beamfile to look for any syntax errors. By default when VOS compiles your file, it outputs the resulting compiled beam file to
/tmpafter which it removes it. Set this to false to have the beam file be outout to the same directory as the
.erlfile you are working on. (defaults to "false")
VOS_CSS_PROFILE: When to validate css against a specific profile. See CSS Validator sommand settings for a list of valid profiles. (defaults to 2.1)
VOS_BASH_SHELLCHECK: use Shellcheck instead of Bash to check shell scripts
VOS_RUBY_RUBOCOP: use RuboCop instead of Ruby to check Ruby scripts
Binary Path Options:
These options are used to specify the full path to the executable binaries for the different commands VOS relies upon. With the exception of
TM_ERB, all of these must be specified for their corresponding validator to work.
TM_COMPASS is set to "false", validation is done using the standard Sass binary.
TM_VOS_RUBY takes priority over
TM_RUBY and is useful in the cases that you
want TextMate to use a different Ruby or Ruby wrapper for validation vs. testing as
TM_VOS_RUBY is always run with
env: ... No such file or directory
If you haven't already done so, make sure your TextMate
PATH shell variable includes
If you installed via the recommended method above by running
git clone..., you can easily update the bundle via
Validate On Save >
The Compass "validation" actually compiles your SASS files and returns any errors or warnings.
If you are using a standalone Compass project, it depends on being able to find your
config.rb file in either the same directory as your SASS files or in one any of the parent directories.
If you're using Compass with Rails it runs
compass --update on your Rails root directory, as determined by the parent of the
public directory. This means your SASS files must be descendants of one of those directories. Compass, by default, installs into
CSS validation is done locally using w3c.org's Jigsaw server. This means it's essentially booting up a java based web server, so it can be relatively slow.
JSON validation is done using
jsonlint, which is installable through the Node Package manager
npm. For installation details, see jsonlint.
Validate On Save is released under the MIT License. Included third-party software are limited to their respective licenses.
growlnotifyis Copyright (c) The Growl Project, 2004-2009 - see growl_license.txt.
- Jigsaw and CSS Validator are distributed under both the W3C Test Suite License and the W3C 3-clause BSD License. To contribute to a W3C Test Suite, see the policies and contribution forms.