Small inconsistency in code folding (PHP)

Report issues, odd behaviors or submit a detailed bug report.
Post Reply
User avatar
pjj
Posts: 2109
Joined: 13 Oct 2009 13:48
Location: Kraków, Poland

Small inconsistency in code folding (PHP)

Post 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
inconsistent-code-folding-in-php.png (30.69 KiB) Viewed 1550 times
Alium tibi quaere fratrem; hic, quem tuum putas, meus est. Titus Flāvius Caesar Vespasiānus Augustus
User avatar
Rickard Johansson
Site Admin
Posts: 6577
Joined: 19 Jul 2006 14:29

Re: Small inconsistency in code folding (PHP)

Post 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...
User avatar
Rickard Johansson
Site Admin
Posts: 6577
Joined: 19 Jul 2006 14:29

Re: Small inconsistency in code folding (PHP)

Post by Rickard Johansson »

Btw. this is what it looks like at my end.

php_if_elseif_folding.png
php_if_elseif_folding.png (27.76 KiB) Viewed 1542 times

I assume this is how it should look? Isn't it?
User avatar
pjj
Posts: 2109
Joined: 13 Oct 2009 13:48
Location: Kraków, Poland

Re: Small inconsistency in code folding (PHP)

Post by pjj »

Yes it is: same folding regions in both sample if..else blocks, unlike at my end.
Alium tibi quaere fratrem; hic, quem tuum putas, meus est. Titus Flāvius Caesar Vespasiānus Augustus
User avatar
Rickard Johansson
Site Admin
Posts: 6577
Joined: 19 Jul 2006 14:29

Re: Small inconsistency in code folding (PHP)

Post by Rickard Johansson »

Are you still using your own custom syntax file? If so - try to update the fold section.
User avatar
pjj
Posts: 2109
Joined: 13 Oct 2009 13:48
Location: Kraków, Poland

Re: Small inconsistency in code folding (PHP)

Post 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.
Alium tibi quaere fratrem; hic, quem tuum putas, meus est. Titus Flāvius Caesar Vespasiānus Augustus
Post Reply