Small feature request for code folding

PHP Tools [?] extends Visual Studio with set of advanced features to work more efficiently with PHP code.

Small feature request for code folding

Postby formula349 » August 26th, 2012, 8:58 pm

I like the how code folding doesn’t fold every if statement and block of code with braces. There are some times where it would be nice to fold a large chunk of code that can’t be in its own function. #region blocks within C# come to mind, perhaps embedded with a php comment so it doesn't interfere with the php code processing?
formula349
 
Posts: 6
Joined: August 26th, 2012, 8:50 pm

Re: Small feature request for code folding

Postby Miloslav Beno » August 26th, 2012, 11:07 pm

Hello,

PHP Tools have this feature already. We use #region/#endregion syntax to achive custome collapsing. e.g

Code: Select all

#region My region

if ($sayhello)
   echo "Hello";

#endregion


then you should be able to fold this block.

Cheers!
Miloslav Beno │ DEVSENSE s.r.o. │ @miloslavbenomiloslav@devsense.com
User avatar
Miloslav Beno
 
Posts: 1252
Joined: January 7th, 2012, 8:36 pm

Re: Small feature request for code folding

Postby formula349 » August 27th, 2012, 2:38 pm

Great, that was fast!

Another thing that would be great is to able to parse and fold javascript in a string. Using the Yii framework, sometimes I'll add some javascript to a page using the code below.

Code: Select all
$cs->registerScript('search', <<<EOD

$("table.green").on("click", "tr", function(event) {
   var batchid = $(this).attr("batch");
    getBatch(batchid);
});
   
function getBatch(id) {
    $("table.green tr").removeClass('selected');
    $("table.green tr[batch="+id+"]").addClass('selected');
   $.ajax({
      type: "POST",
      url: "?getBatch=1",
         dataType: "json",
      data: { batchid: id },
      success: function(data, textStatus, jqXHR) {
         if(data.error) {
                alert(data.error);
         } else {
            $("table.blue tbody").html(data.html);
         }
      },
      failure: function(jqXHR, textStatus, errorThrown) {
         alert(errorThrown);
      },
      complete: [$.qms.AjaxComplete, function(jqXHR, textStatus) {
         if(textStatus != 'success') {
            error = $.qms.logAjaxError(this, jqXHR, textStatus);
                alert(error);
         }
      }]
   });   
}
EOD
);

I'd LOVE the ability to treat that block of javascript between the EOD marks with full syntax highlighting, folding, intellisense, etc.
formula349
 
Posts: 6
Joined: August 26th, 2012, 8:50 pm

Re: Small feature request for code folding

Postby Miloslav Beno » August 27th, 2012, 3:02 pm

That is interesting features and certainly possible, it would require some kind of language rocognization. And also preequisite feature viewtopic.php?f=21&t=755
Miloslav Beno │ DEVSENSE s.r.o. │ @miloslavbenomiloslav@devsense.com
User avatar
Miloslav Beno
 
Posts: 1252
Joined: January 7th, 2012, 8:36 pm


Return to PHP Tools

Who is online

Users browsing this forum: No registered users and 53 guests

cron

User Control Panel

Login

Who is online

In total there are 53 users online :: 0 registered, 0 hidden and 53 guests (based on users active over the past 5 minutes)
Most users ever online was 256 on March 28th, 2024, 9:42 am

Users browsing this forum: No registered users and 53 guests