Error message

You need to log in or create an account to access this page.

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.

CommentFileSizeAuthor
add_drupalcs_syntastic_support.patch2.98 KBethanw

Comments

mortona2k’s picture

Is this patch the only way to add syntastic support?

mortona2k’s picture

I 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:

Error detected while processing function <SNR>70_UpdateErrors..<SNR>70_CacheErrors..SyntaxCheckers_drupal_GetLocList:
line   12:
E117: Unknown function: SyntasticHighlightErrors

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.

benjifisher’s picture

@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 SyntasticHighlightErrors function is undefined. Try updating the Syntastic plugin.

The way vim initialization files work, you expect to have files named drupal.vim under several different directories. Not a problem.

@ethanw: The patch I mentioned adds 7 lines to ftplugin/drupal.vim and 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?

benjifisher’s picture

Status: Needs review » Closed (duplicate)

I 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.vim in order to support Syntastic.

I am closing this issue for now. @ethanw, if you can explain the advantage of a separate syntax_checkers/drupal.vim files, then please re-open the issue.