NuSphere Forums Forum Index
NuSphere Forums
Reply to topic
Again code folding
Veteran

Joined: 06 Mar 2007
Posts: 158
Location: Poland
Reply with quote
And why (just simple) not folding for every { ... } chars ? (this could work even for css files).

For javascript where in one file are many funcs only one possibility is doing something like this:

/* <? // maby some info
{ ?> */
function jsfunction ()
{
... // eg. long code
} /* <? } ?> */

And with this js code PhpED finds folding part automatically (but really want to adding it everywhere? no!). Handling selection is not good if there are many things in one file (every time unselect and select ?) and its really very good but for some cases.

Also maby add here something like: #region and #endregion folding tags ? It would be really succesfull feature for PhpED.

Regards.

_________________
ML
View user's profileFind all posts by introSend private messageVisit poster's website
Re: Again code folding


Joined: 04 Feb 2005
Posts: 26
Reply with quote
intro wrote:

Also maby add here something like: #region and #endregion folding tags ? It would be really succesfull feature for PhpED.

Regards.



I subscribe to this... we should be able to fold all {...} blocks automatically without any select.
We should also be able to select part of the code and save as a region so we can restore the folding at any time without reselecting.

Any chance to know when this is possible to be added?
View user's profileFind all posts by CrirusSend private message


Joined: 04 Feb 2005
Posts: 26
Reply with quote
I may be testing on old version, but why cant I fold a function form the bottom }.... I have to scroll up to function definition start... was this resolved?
View user's profileFind all posts by CrirusSend private message
Site Admin

Joined: 13 Jul 2003
Posts: 8342
Reply with quote
it wasn't a problem from the beginning. Press Ctrl-Plus to collapse code under cursor.

_________________
The PHP IDE team
View user's profileFind all posts by dmitriSend private messageVisit poster's website


Joined: 04 Feb 2005
Posts: 26
Reply with quote
dmitri wrote:
it wasn't a problem from the beginning. Press Ctrl-Plus to collapse code under cursor.


Alright it works, although a - sign at the ending } would be more intuitive if I am not shortcuts freak... there are quite a few to remember in the end Smile


Any thoughts on #region idea above?
View user's profileFind all posts by CrirusSend private message
Site Admin

Joined: 13 Jul 2003
Posts: 8342
Reply with quote
Quote:
Any thoughts on #region idea above?

I don't like the idea of patching sources with somehting like this. Although fill free to run poll on the Feat Request forum to see if the idea gets any significant support.

_________________
The PHP IDE team
View user's profileFind all posts by dmitriSend private messageVisit poster's website


Joined: 04 Feb 2005
Posts: 26
Reply with quote
dmitri wrote:
Quote:
Any thoughts on #region idea above?

I don't like the idea of patching sources with somehting like this. Although fill free to run poll on the Feat Request forum to see if the idea gets any significant support.


Well, maybe you dont have to save this into source file, but some xml along with the project file ...
View user's profileFind all posts by CrirusSend private message
Veteran

Joined: 26 Dec 2006
Posts: 253
Location: Phoenix, AZ
Reply with quote
dmitri wrote:
Quote:
Any thoughts on #region idea above?

I don't like the idea of patching sources with somehting like this


In general, I agree. However, if the extra markup is semi-standardized, then I think the usefulness of it outweighs the downsides. In this respect, it's not too unlike how so much code insight functionality is tied to PhpDoc comments, even though individual programmers (and perhaps even company guidelines) might prefer a completely different comment structure.

I know VisualStudio does something like this, and I believe vim does, as well. Do they have a common syntax that could be adopted by PhpED?
View user's profileFind all posts by bobwilliamsSend private messageVisit poster's website
Veteran

Joined: 06 Mar 2007
Posts: 158
Location: Poland
Reply with quote
How hard will be for You implement folding for this:

#{
...
#}

or this

//{
...
//}

Becouse in some codes in structural meaning i can fold by doing it:

// some code
{
//some other code
function 1() {}
...
function2() {}
//many other lines
}

Then in classes or etc. it is not possible to do this - but I want to make fold for some method groups, eg.

class A
{
function1() {}
{
function2() {}
...
function3() {}
}
}

cant work.

So?

Regards

_________________
ML
View user's profileFind all posts by introSend private messageVisit poster's website
How about this for the region idea?


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
Again 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