create fold block

Discuss syntax highlighting or submit new syntax files.
Post Reply
jerry1970
Posts: 226
Joined: 25 Jul 2006 07:41
Location: Netherlands

create fold block

Post 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
User avatar
Rickard Johansson
Site Admin
Posts: 6627
Joined: 19 Jul 2006 14:29

Post by Rickard Johansson »

Try this:

Rgn_Start = "[START]"
Rgn_End = "[END]"
Rgn_CommentStart = "//"
jerry1970
Posts: 226
Joined: 25 Jul 2006 07:41
Location: Netherlands

Post 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
User avatar
Rickard Johansson
Site Admin
Posts: 6627
Joined: 19 Jul 2006 14:29

Post 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.
jerry1970
Posts: 226
Joined: 25 Jul 2006 07:41
Location: Netherlands

Post by jerry1970 »

It works, thanks!
And thanks for the explanation - I don't use .NET yet, but will find out soon, I gues... ;)
Incrazap
Posts: 1
Joined: 24 Feb 2009 23:38

Post 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 = "//" 

User avatar
Rickard Johansson
Site Admin
Posts: 6627
Joined: 19 Jul 2006 14:29

Post 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.
Post Reply