NuSphere Forums Forum Index
NuSphere Forums
Reply to topic
Modifying code folding


Joined: 01 Aug 2009
Posts: 2
Reply with quote
Hi,

after searching - and not finding any solution - I hope someone can help me out with this one:
I'd like to add a new keyword-combination to the code folding feature so that PHPEd "understands" my VisualStudio-like #region ... #endregion tags (which originate from the previously used IDE).
Is there any possibility to accomplish this?

Forgive me, if I'm asking a question already answered - but I could not find it (maybe you're able to point me to? Wink)

Thank you and kind regards
-lehacky
View user's profileFind all posts by lehackySend private message
Guru master

Joined: 05 Jul 2004
Posts: 659
Location: Belgium
Reply with quote
AFAIK it is not possible to change the patterns the editor recognizes as folding sections. Something similar has been requested already I think. Although I don't use it I can certainly see the handiness in it.
View user's profileFind all posts by BlizzSend private messageVisit poster's website


Joined: 01 Aug 2009
Posts: 2
Reply with quote
Hi Blizz,

thanks for your reply - so let's see, if this marvelous IDE gets also this feature for us.

-lehacky
View user's profileFind all posts by lehackySend private message
Will this work for you?


Joined: 02 Dec 2015
Posts: 9
Reply with quote
From documentation on php.net:
http://www.php.net/manual/en/control-structures.intro.php

Quote:
Any PHP script is built out of a series of statements. A statement can be an assignment, a function call, a loop, a conditional statement or even a statement that does nothing (an empty statement). Statements usually end with a semicolon. In addition, statements can be grouped into a statement-group by encapsulating a group of statements with curly braces. A statement-group is a statement by itself as well. The various statement types are described in this chapter.


In other words, the following code is valid PHP code:

Code:

echo 'Hello World';
{ //polite stuff
    echo ", it's nice to meet you.\n";
    echo "May I be of service?\n";
}


The curly braces define a statement group similar to when used with if, else, foreach, etc. It does not create a new variable scope, but can be used to format/organize code in some arbitrary way. Statement groups can contain almost anything (assuming nest conventions are followed). Some things that can't be used inside statement blocks are: namespace, use, (global) const, and __halt_compiler().

Anything in curly braces will have a fold mark in PhpED. That includes statement groups which then function just as one would hope/expect. One feature that would be nice is if PhpED showed the comment immediately after the starting brace while the group is folded. One can even make a shortcut to create a foldable statement group using code snippets in PhpED. For example, the following template could be created and assigned to the keyboard combination Ctrl+Alt+B
Code:
{// my_custom_code_block
|}

Thereafter one could highlight a block of code then hit Ctrl+Alt+B to wrap the highlighted statements in curly braces, creating a statement group.
View user's profileFind all posts by pantsmannSend private message
Modifying code folding
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT - 5 Hours  
Page 1 of 1  

  
  
 Reply to topic