Page 1 of 1

create fold block

Posted: 05 Nov 2007 09:07
by jerry1970
Inside PHP scripts, I want to fold a rather large collection of functions that I don't have to see the whole time. I tried to create a folding block that starts with a certain comment and ends with another. Something like this:

Code: Select all

// [START] Properties: Set functions
function SetTableName( $name ) {
   set $this->m_TableName = trim( $name );
}
// [END] Properties: Set functions

// [START] Properties: Get functions
function GetTableName() {
   return $this->m_TableName;
}
// [END] Properties: Get functions
How can I do this? The block start and block end are comments, so maybe TextEd skips checking the format for block items?

Thanks!
Jerry

Posted: 05 Nov 2007 09:22
by Rickard Johansson
Try this:

Rgn_Start = "[START]"
Rgn_End = "[END]"
Rgn_CommentStart = "//"

Posted: 05 Nov 2007 09:27
by jerry1970
Rickard Johansson wrote:Try this:

Rgn_Start = "[START]"
Rgn_End = "[END]"
Rgn_CommentStart = "//"
Doesn't work...

I have these regions set, and then created a fold block:
Fold_Begin = "// [START]"
Fold_End = "// [END]"
but that doesn't work either.

What exactly is that Region setting for? Why is there only one Region per syntax file?

Thanks!
Jerry

Posted: 05 Nov 2007 14:37
by Rickard Johansson
It's the last ] character that makes it not work. This will though. In your syntax file add: (don't use the Fold_... options)

Code: Select all

  Rgn_Start = "$REGIONSTART"
  Rgn_End = "$REGIONEND"
  Rgn_CommentStart = "//"
In code write:

Code: Select all

   //$REGIONSTART "This is a region"
   ...

   //$REGIONEND
Note that there is no space between // and $.

Regions are used in .NET languages like C# and Delphi .NET. In Delphi .NET a comment is used to "hide" the region keywords, like above. To create a region you only need 1 set of keywords. In your code you can then create as many regions you want and e.g. use a string at the start to identify them.

Posted: 05 Nov 2007 15:15
by jerry1970
It works, thanks!
And thanks for the explanation - I don't use .NET yet, but will find out soon, I gues... ;)

Posted: 25 Feb 2009 00:01
by Incrazap
I found this thread while doing a search. I am an experienced PHP coder, but I am a TextEd absolute newbie. Please give me detailed instructions regarding exactly where in TextEd I should put this code:

Code: Select all


  Rgn_Start = "$REGIONSTART"
  Rgn_End = "$REGIONEND"
  Rgn_CommentStart = "//" 


Posted: 25 Feb 2009 10:51
by Rickard Johansson
The lines

Code: Select all

Start=__START__
End=__END__
CommentStart=//
was added to the syntax file.

Use

Code: Select all

//__START__

...

//__END__
It can be changed in the "..\AppData\RJ TextEd\Syntax\php.syx" file. But it is overwritten every time you update the program.