You are here: PSPad forum > English discussion forum > PHP live syntax check

PHP live syntax check

#1 PHP live syntax check

Posted by: viplex | Date: 2017-04-20 07:00 | IP: IP Logged

Hi,
I work with several IDEs for php and they all have one feature that I would love in pspad. It's live syntax check - if you have a typo or something is missing in your code the line number will be highlighted. Now I know pspad is not an ide but I see that you have the possibility to add a compiler and use php -l {filename} (for lint). This works fine and prints the lint output into the console. Actually this is already pretty good.

Is it possible to parse this output somehow? Can you point me in the right direction? These are the things I would like to know:

1) Trigger extension on button press (possible with javascript) or other event (like save, do you have js callbacks for that?)

2) Possible to get the log content to js somehow?
3) Possible to highlight line/add breakpoint/jump to line from js?

I tried to find a documentation for the extensions but was not very successfull with that so far.

Best regards

Options: Reply | Quote | Up ^


#2 Re: PHP live syntax check

Posted by: viplex | Date: 2017-04-20 07:18 | IP: IP Logged

Wanted to edit the last post but it didn't let me ...

image

Options: Reply | Quote | Up ^


#3 Re: PHP live syntax check

Posted by: pspad | Date: 2017-04-20 07:37 | IP: IP Logged

Hello
With php.exe set as compiler you can check syntax
If you will set code parser expression in compiler settings, PSPad will automatically jump to error line in your source

You can read write into LOG with PSPad scripting, you can call compiler from PSPad scripting (no problem to write script in JS)

Forum allows you modify your post for limited time (10 minutes). It's enough to correct typos.

Options: Reply | Quote | Up ^


#4 Re: PHP live syntax check

Posted by: viplex | Date: 2017-04-20 07:41 | IP: IP Logged

Hi,
thank you very much, you are right, this is working now.
I had a default of

*on line<b>%L

but the lint did not produce html errors.
It now works with:


*on line %L

Thank you.

Edited 2 time(s). Last edit at 2017-04-20 07:41 by viplex.

Options: Reply | Quote | Up ^


#5 Re: PHP live syntax check

Posted by: DonQuichote | Date: 2017-04-25 10:36 | IP: IP Logged

Apart from setting it as compiler, you can also set it as a "tool" link. The advantage of that is that you can set more tool links, but only one compiler for a file type.
image

Options: Reply | Quote | Up ^






Editor PSPad - freeware editor, © 2001 - 2024 Jan Fiala, Hosted by Webhosting TOJEONO.CZ, design by WebDesign PAY & SOFT, code Petr Dvořák, Privacy policy and GDPR