sublimetext2 - PHP Syntax Check in Sublime Text Editor -



sublimetext2 - PHP Syntax Check in Sublime Text Editor -

in gedit, can add together external tool of "php -l" on current document, , if have php command line installed, syntax check document. there way sublime text editor? (note, have mac , has php cli installed.)

i imagine i'll have paste code snippet sublime plugin, right?

the action referring called "linting" , there number of plugins sublime lint php files. mentioned len_d, php syntax checker one, i'd recommend sublimelinter sublime text 2 instead. (there different version of sublimelinter st3, it's not backwards-compatible, , has different architecture st2 version, no longer officially supported.)

to install, first install bundle control if haven't already, restart sublime. open command palette ctrlshiftp , type pci bring package control: install package. nail enter, type in sublimelinter, nail enter 1 time again install. after installation complete, restart st2 1 time again luck. configure, first open sublime text 2 -> preferences -> bundle settings -> sublimelinter -> settings-default , re-create entire contents. then, open settings-user same sub-menu , paste contents it. can close settings-default. proper syntax highlighting (to tell comments are), select javascript -> json alternative list in lower right of sublime window.

scroll downwards line 36 in "sublimelinter_executable_map" dict , add together blank line between opening { , closing } braces. find total path php executable on scheme opening terminal , typing which php. re-create path , add together entry "php" on blank line made. example, if path /opt/local/bin/php, total section should this:

class="lang-json prettyprint-override">"sublimelinter_executable_map": { "php": "/opt/local/bin/php" },

scroll downwards through rest of "sublimelinter_*" options , modify them suit preferences. options after line 108 irrelevant you, deal linters javascript, css, python, etc. however, sense free read through them in case you'd utilize sublimelinter other languages. 1 time you're done, save file , should set. sublimelinter display messages according "sublimelinter" (line 13) , "sublimelinter_delay" settings (line 67) (increase value increment delay between stopping typing , linter messages appearing). if don't want "live" linting, set "sublimelinter" load-save, save-only, or false, depending on preferences. find live linting rather annoying...

and that's it. total documentation available in readme. please maintain in mind if/when upgrade sublime text 3 (which highly recommend, way), you'll need install , configure sublimelinter3, finish re-write of plugin more modular architecture. such, base of operations sublimelinter bundle must supplemented language-specific linter plugin sublimelinter-php. please ensure read full documentation (yes, there's lot, it's worth it) running smoothly.

good luck!

php sublimetext2 sublime-text-plugin syntax-checking

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -