Closed Craige closed 9 years ago
|let g:checksyntax.php.auto = 1 | In a recent version of checksyntax, it's preferable to use
let g:checksyntax#auto_enable_rx = '^php$'
or add an auto field to the definition (see :h checksyntax#AddChecker).
|if !exists('g:checksyntax.php')|
Which version of checksyntax do you use? Where is this check? Do you use the current version from https://github.com/tomtom/checksyntax_vim/?
Why do you re-add the "php"-checker? Is it because php.vim doesn't seem
to get loaded or to reverse the order of type checkers? In the latter
case, you might want to set g:checksyntax#preferred.php
instead.
I'll check my checksyntax version in the morning, but I haven't updated it in a year, so I'm sure it could stand to be updated.
As for why I re-added the "php" checker, it was because it no longer got added to the alternatives list when I added the "phpcs" checker. I added those lines in a local .vimrc file in my project directory (loaded with the exrc setting).
I'll update my checksyntax in the morning and make the amendments you suggested. I'll report back with the status afterwords.
On April 11, 2015 1:28:32 AM EDT, Tom Link notifications@github.com wrote:
|let g:checksyntax.php.auto = 1 | In a recent version of checksyntax, it's preferable to use
let g:checksyntax#auto_enable_rx = '^php$'
or add an auto field to the definition (see :h checksyntax#AddChecker).
|if !exists('g:checksyntax.php')|
Which version of checksyntax do you use? Where is this check? Do you use the current version from https://github.com/tomtom/checksyntax_vim/?
Why do you re-add the "php"-checker? Is it because php.vim doesn't seem
to get loaded or to reverse the order of type checkers? In the latter case, you might want to set
g:checksyntax#preferred.php
instead.
Reply to this email directly or view it on GitHub: https://github.com/tomtom/checksyntax_vim/issues/28#issuecomment-91765458
Sent from my Android device with K-9 Mail. Please excuse my brevity.
Okay. I'm up to date with the most recent version on master (0db7298), and I've changed my .vimrc to reflect the following
call checksyntax#AddChecker('php?',
\ {
\ 'name': 'phpcs',
\ 'auto': 1,
\ 'cmd': 'bin/phpcs --report=emacs',
\ 'if_executable': 'bin/phpcs',
\ 'efm': '%f:%l:%*[^:]: %*[^-]- %m',
\ }
\ )
However now it appears that the phpcs
checker isn't running at all. The file I'm running it on does indeed have violations, and I've verified so at the command line. This checker doesn't run on save, nor does it run when I run the :CheckSyntax
command manually.
I don't think this is related, but when I start vim now I get:
Error detected while processing function pathogen#helptags:
line 4:
E154: Duplicate tag "g:checksyntax#async_runner" in file /Users/craigeleeder/.vim/bundle/checksyntax_vim/doc/checksyntax.txt
E154: Duplicate tag "g:checksyntax#async_runner" in file /Users/craigeleeder/.vim/bundle/checksyntax_vim/doc/checksyntax.txt
CheckSyntax: Run vim with the --servername NAME command line option to enable use of AsyncCommand
|call checksyntax#AddChecker('php?',| Try "php" without the "?" -- define only if it doesn't exist yet. The questionmark should only be used in the default syntax checker definitions.
If you still have problems, I'll look into it when I find some time.
Problem still persists. Is there any way to get debug output from checkSyntax?
I think I see the problem. When I set the CheckSyntax to use the global phpcs
, I get a proper response. However, when I try to use the bin/phpcs
(which is in my to my current directory. i.e. the projects directory), I don't get any output. So my guess is that checksyntax can't find bin/phpcs
in the current working directory. ~Any thoughts on that?~
Using ./bin/phpcs worked.
Would you be interested in taking a PR that adds phpcs
to php.vim
, along with some new configuration variables for setting the phpcs
path and parameters?
So my guess is that checksyntax can't find |bin/phpcs| in the current working directory.
Is "bin/" in $PATH? It seems the argument to
executable()
should be the executable name without arguments. See also:h executable()
. You could remove the if_executable field, since you know it is installed.
bin/ was in my current directory, so yes.. In any case, using ./bin/phpcs works, so I'm happy.
I've added a PHPCS checker locally, but I'm not exactly sure I'm doing it correctly. In order to get it to work, I had to add the following to my .vimrc file
I just wanted to add the first
phpcs
checker, but when I added this, the contents ofphp.vim
no longer execute due to theif !exists('g:checksyntax.php')
check. Is there another way I should be adding this checker to build on top of the existingphp.vim
file?Worth noting- I added this to a project specific
.vimrc
in my project directory, and checksyntax is loaded via Pathogen. I'm not sure if that matters