PHP Automatic Syntax Check - On Cursor Movement

Let us know what you would like to see in the next version of this software

Moderator: kfury77

Forum rules
Please follow these guidelines when posting feature requests. This will help to increase the value of your contribution.

  • Do not create new topics for already requested features. Add your comments to the existing feature request topics instead;
  • Create separate topic for each feature suggestion. Do NOT post a number of non-related feature suggestions in a single topic;
  • Give your topic a meaningful title. Do NOT create topics with meaningless titles, such as "My Suggestion" or "My Problem".

Please note that we DO READ all suggestions, even if a reply is not posted. Thanks!

PHP Automatic Syntax Check - On Cursor Movement

Postby Will Fastie » Wed Jun 14, 2017 6:16 am

When automatic syntax checking is enabled in Rapid PHP, syntax is checked whenever the line count of the file changes.

Instead, check the syntax whenever the editor insertion point moves away from a line that has changed.

I define a changed line as follows:
  • A new line, one that was just added by typing or pasting.
  • A deleted line.
  • A line in which the character length has changed since the insertion point was moved into it.
I believe this will eliminate the need to manually request a syntax check and will not add any significant checking overhead.
Will
WebDesignBuild.biz, Fastie.com
User avatar
Will Fastie
 
Posts: 160
Joined: Mon Jan 31, 2005 6:47 pm
Location: Timonium, MD USA

Re: PHP Automatic Syntax Check - On Cursor Movement

Postby Aivars » Fri Jun 16, 2017 11:34 am

That's a good point, this has been bothering me as well, I will create a ticket with the request.
Blumentals Software Programmer
User avatar
Aivars
Blumentals Software Developer
 
Posts: 2453
Joined: Thu Aug 22, 2002 1:40 pm
Location: Latvia

Re: PHP Automatic Syntax Check - On Cursor Movement

Postby Will Fastie » Fri Jun 16, 2017 2:31 pm

If this idea ever gets to the implementation stage, I'll be happy to help test.
Will
WebDesignBuild.biz, Fastie.com
User avatar
Will Fastie
 
Posts: 160
Joined: Mon Jan 31, 2005 6:47 pm
Location: Timonium, MD USA

Re: PHP Automatic Syntax Check - On Cursor Movement

Postby Will Fastie » Thu Jul 06, 2017 2:37 pm

I wanted to update my original suggestion. I wrote:
... check the syntax whenever the editor insertion point moves away from a line that has changed.

Then I defined "changed" as meaning adding, deleting, or editing a line.

My new thought is that adding or deleting a blank line should not count as an added or deleted line because blank lines do not affect syntax in PHP (or CSS, HTML, JS, etc.).

I mention this because I have noticed that the pink highlight for an error line can vanish quickly when typing continues. I would like that highlight to remain as long as possible, so I thought about the conditions under which the highlight would be removed. I think that should be when the next syntax check happens and that means it is important make sure that no extraneous syntax checks are initiated to give the coder has as much time as possible to notice that an error has been found.

I can't speak to Blumentals' code and I might be wrong about this, but I think the idea of only invoking a syntax check when something has actually changed will reduce syntax checking overhead. The definition of "changed" means that the modification is one that can affect syntax and my new realization is that adding or deleting blank lines does not affect syntax, a statement that applies not only to PHP but also to CSS, HTML, and JS.

Finally, if a line with an error is highlighted (which in my scenario means that no subsequent syntax check has been invoked) and the user saves/closes the file, automatically run a syntax check. I have not carefully thought out the implications of this. I don't want the editor telling me I can't close the file but I also don't want to close a file thinking everything is okay when it isn't.
Will
WebDesignBuild.biz, Fastie.com
User avatar
Will Fastie
 
Posts: 160
Joined: Mon Jan 31, 2005 6:47 pm
Location: Timonium, MD USA

Re: PHP Automatic Syntax Check - On Cursor Movement

Postby Aivars » Tue Jul 18, 2017 2:25 pm

I like the idea of syntax checking on save, probably right after the save. It's a logical place to check for syntax errors because generally people will save their code after completing a line or a group of lines that they expect to be correct. We will add it to the next big version.

About the blank lines, we will give it a thought. Like you said, we must consider the implications.
Blumentals Software Programmer
User avatar
Aivars
Blumentals Software Developer
 
Posts: 2453
Joined: Thu Aug 22, 2002 1:40 pm
Location: Latvia

Re: PHP Automatic Syntax Check - On Cursor Movement

Postby Will Fastie » Fri Apr 13, 2018 9:42 pm

I see that PHP syntax checking has changed in Rapid 2018. Can you describe exactly how it works now?
Will
WebDesignBuild.biz, Fastie.com
User avatar
Will Fastie
 
Posts: 160
Joined: Mon Jan 31, 2005 6:47 pm
Location: Timonium, MD USA

Re: PHP Automatic Syntax Check - On Cursor Movement

Postby Aivars » Mon Apr 16, 2018 2:36 pm

The most significant changes are that background syntax checking will be scheduled on these additional actions:
- document is saved
- user has modified a line and then moved text cursor away from it.
Blumentals Software Programmer
User avatar
Aivars
Blumentals Software Developer
 
Posts: 2453
Joined: Thu Aug 22, 2002 1:40 pm
Location: Latvia

Re: PHP Automatic Syntax Check - On Cursor Movement

Postby Will Fastie » Mon Apr 16, 2018 3:49 pm

If I recall correctly, 2016 checked syntax when the line count changes. Is that still in effect?
Will
WebDesignBuild.biz, Fastie.com
User avatar
Will Fastie
 
Posts: 160
Joined: Mon Jan 31, 2005 6:47 pm
Location: Timonium, MD USA

Re: PHP Automatic Syntax Check - On Cursor Movement

Postby Aivars » Mon Apr 16, 2018 4:13 pm

Yes, that remains, too.
Blumentals Software Programmer
User avatar
Aivars
Blumentals Software Developer
 
Posts: 2453
Joined: Thu Aug 22, 2002 1:40 pm
Location: Latvia

Re: PHP Automatic Syntax Check - On Cursor Movement

Postby Will Fastie » Mon Apr 16, 2018 4:48 pm

I want to make sure I understand this clearly.

RapidPHP automatically checks PHP syntax when:
  • The text cursor moves away from a line which has changed.
  • The number of lines in the file changes (line added, line deleted).
  • The file is saved.
By implication, a syntax check will also be conducted when the "Save and Upload File to FTP" function is used because this combination includes a file save. Correct?

Am I missing anything else?
Will
WebDesignBuild.biz, Fastie.com
User avatar
Will Fastie
 
Posts: 160
Joined: Mon Jan 31, 2005 6:47 pm
Location: Timonium, MD USA

Re: PHP Automatic Syntax Check - On Cursor Movement

Postby Aivars » Mon Apr 16, 2018 5:04 pm

I don't think you're missing anything. And yes, Save and Upload to FTP asks for syntax check, too.
Blumentals Software Programmer
User avatar
Aivars
Blumentals Software Developer
 
Posts: 2453
Joined: Thu Aug 22, 2002 1:40 pm
Location: Latvia

Re: PHP Automatic Syntax Check - On Cursor Movement

Postby Will Fastie » Tue Apr 17, 2018 4:47 am

PHP syntax checking in Rapid 2018 seems much improved.

The only quirk is with "Save and Upload File to FTP." I don't know what the order of operations is (save, check, FTP?) but whatever it is the syntax check seems to finish last. This has resulted in my publishing a file that contained a syntax error.

I think that Save and Upload should not upload if a syntax error is found. I realize that this may delay the FTP operation briefly.
Will
WebDesignBuild.biz, Fastie.com
User avatar
Will Fastie
 
Posts: 160
Joined: Mon Jan 31, 2005 6:47 pm
Location: Timonium, MD USA

Re: PHP Automatic Syntax Check - On Cursor Movement

Postby Aivars » Tue Apr 17, 2018 11:27 am

The syntax checking is not meant to be blocking, it's a background syntax check for quickly noticing any mistakes but without affecting performance.

If you really need that blocking action, one solution would be to make a plugin that does PHP Syntax Check -> Save & Upload to FTP or Save, depending on success, and use this new plugin action instead of Save & Upload to FTP.
Blumentals Software Programmer
User avatar
Aivars
Blumentals Software Developer
 
Posts: 2453
Joined: Thu Aug 22, 2002 1:40 pm
Location: Latvia

Re: PHP Automatic Syntax Check - On Cursor Movement

Postby Will Fastie » Tue Apr 17, 2018 2:01 pm

The syntax checking is not meant to be blocking...

It should be blocking. Save & Upload should not complete if there is a syntax problem.

Consider a simple case - I enter a new line of PHP code and forget to put the semicolon at the end. Without moving the cursor off the line, I click the Save & Upload button. The timings are such that the file gets uploaded before Rapid shows me the error. (I am not complaining about the speed of the syntax check; I understand what is being done and realize that it won't get faster.)

The suggestion that I write a plug-in falls on deaf ears. As I have mentioned in previous posts here, I am interested in an out-of-the-box experience that is practical and complete. My business is writing PHP code for Web sites, not building the PHP tool.

I appreciate the syntax-checking improvements that have been made in 2018; I'm simply suggesting that a few more are needed.
Will
WebDesignBuild.biz, Fastie.com
User avatar
Will Fastie
 
Posts: 160
Joined: Mon Jan 31, 2005 6:47 pm
Location: Timonium, MD USA

Re: PHP Automatic Syntax Check - On Cursor Movement

Postby pmk65 » Tue Apr 17, 2018 2:23 pm

Will Fastie wrote:
The syntax checking is not meant to be blocking...

It should be blocking. Save & Upload should not complete if there is a syntax problem.


I agree with Aivars. I would find it extremely annoying if saving was blocked due to an error. As i run my syntax checking, minifying, compiling etc. in the background (using Gulp).
And you can't rely on WeBuilder/RapidPHP matches a new version of i.e. PHP that might support a new syntax.
There are 10 types of people in the world: Those who understand binary and those who don't.
User avatar
pmk65
 
Posts: 678
Joined: Sun Dec 20, 2009 9:58 pm
Location: Copenhagen, Denmark

Next

Return to HTMLPad / Rapid CSS / Rapid PHP / WeBuilder Feature Requests

Who is online

Users browsing this forum: No registered users and 13 guests

cron