Page 1 of 1
Small inconsistency in code folding (PHP)
Posted: 06 Apr 2023 16:14
by pjj
In PHP there are two coding styles when it comes to if..else blocks; in the first one (that can be called official, as of
https://github.com/php-fig/per-coding-s ... er/spec.md), elseif doesn't get its code folding trigger:

- inconsistent-code-folding-in-php.png (30.69 KiB) Viewed 3106 times
Re: Small inconsistency in code folding (PHP)
Posted: 06 Apr 2023 17:18
by Rickard Johansson
As far as I can tell - the coding style guide doesn't contain any advice on how code editors should handle folding

It does say however that "elseif" should be used instead of "else if". But that shouldn't affect folding...
Re: Small inconsistency in code folding (PHP)
Posted: 06 Apr 2023 19:10
by Rickard Johansson
Btw. this is what it looks like at my end.

- php_if_elseif_folding.png (27.76 KiB) Viewed 3098 times
I assume this is how it should look? Isn't it?
Re: Small inconsistency in code folding (PHP)
Posted: 06 Apr 2023 21:44
by pjj
Yes it is: same folding regions in both sample if..else blocks, unlike at my end.
Re: Small inconsistency in code folding (PHP)
Posted: 18 Apr 2023 09:13
by Rickard Johansson
Are you still using your own custom syntax file? If so - try to update the fold section.
Re: Small inconsistency in code folding (PHP)
Posted: 18 Apr 2023 09:57
by pjj
I've never used custom PHP syntax file
Right now I notice problems with folding if..else branches only during adding them and they usually go away (= fold icon appears on the gutter) after adding newline (hitting Enter key) someplace.