Home Download Buy Blog Forum Support

Code Folding and PHP HEREDOC

Code Folding and PHP HEREDOC

Postby WetCoast on Sat Dec 15, 2012 1:42 am

I use a lot of HEREDOC statements in my PHP and noticed that this seems to severely get in the way of code folding in Sublime. E.g. try folding the example function, or the "then" portion of the if statement in this code to see what I mean:
Code: Select all
<?php
function example($a)
{
    if (1)
    {
        echo $a;
        $str = <<<HEREDOC
    line1
    line2
HEREDOC;
        echo $a;
    }
    else
    {
        echo $a;
        echo $a;
    }
}


In reading this recent post (http://www.sublimetext.com/forum/viewtopic.php?p=39663#p39663), it sounds like the folding logic is based on indent levels, which certainly doesn't work with PHP's HEREDOC requirement of having the ending marker in column 1. See http://php.net/manual/en/language.types.string.php#language.types.string.syntax.heredoc.

Are there any workarounds in Sublime for this? Am I doing something wrong here?
WetCoast
 
Posts: 1
Joined: Sat Dec 15, 2012 1:26 am

Re: Code Folding and PHP HEREDOC

Postby bkdotcom on Fri Dec 13, 2013 6:30 am

I googled "sublime folding heredoc" and found this "thread"
seems like if there's a matching bracket, it should fold based on the matching bracket.
bkdotcom
 
Posts: 2
Joined: Fri Dec 13, 2013 6:26 am


Return to Technical Support

Who is online

Users browsing this forum: Exabot [Bot] and 16 guests