This was posted at #1328552: Add support for Coder code reviews and Syntastic plugin before I realized that that thread was actually Coder-specific, and the DrupalCS/Syntastic integration was likely best treated in a separate thread. I will re-post the patch and comments from that thread here and mark my comments there to be (mostly) ignored.
Syntastic now supports multiple filetype checking, so we can add a drupal syntax checker directly w/o needing to modify any global variable settings. The attached patch adds a filetype-based syntax checker for all files with ft=drupal (this may need to be adapted for css.drupal files!), without requiring any additional vimrc configuration. It should work out of the box on any machine with syntastic and drupalcs installed. I think this method is superior to the one in the referenced blog post...I'm going to post and update to the post with this recommendation.
| Comment | File | Size | Author |
|---|---|---|---|
| add_drupalcs_syntastic_support.patch | 2.98 KB | ethanw |
Comments
Comment #1
mortona2k commentedIs this patch the only way to add syntastic support?
Comment #2
mortona2k commentedI applied the patch, which creates the syntax_checkers directory and drupal.vim. I already had syntax/drupal.vim, so I'm not sure if this worked properly?
When I first load a file into vi and type :Errors, I get nothing. When I save the file, I get some vim errors:
If I ignore them and continue, syntastic works fine. :Errors now works when called. Did I do something wrong with the installation? I am using Janus btw.
Comment #3
benjifisher@mortona2k: Another way to get Syntastic support is to use the patch from #1328552-11: Add support for Coder code reviews and Syntastic plugin.
The error message you got says that the
SyntasticHighlightErrorsfunction is undefined. Try updating the Syntastic plugin.The way vim initialization files work, you expect to have files named
drupal.vimunder several different directories. Not a problem.@ethanw: The patch I mentioned adds 7 lines to
ftplugin/drupal.vimand works for me. What is the advantage of adding a separate, 62-line file? Is the idea to avoid using DrupalCS when editing non-Drupal PHP files?Comment #4
benjifisherI meant to refer to the patch #1328552-10: Add support for Coder code reviews and Syntastic plugin, not #11 in that issue. The patch in #10 adds support for Coder and also adds 7 lines to
ftplugin/drupal.vimin order to support Syntastic.I am closing this issue for now. @ethanw, if you can explain the advantage of a separate
syntax_checkers/drupal.vimfiles, then please re-open the issue.