Create Foldblock for T-SQL

Discuss syntax highlighting or submit new syntax files.
Post Reply
taucher1
Posts: 5
Joined: 21 Apr 2009 10:52

Create Foldblock for T-SQL

Post by taucher1 »

Hi all,
how can I create a Fold for T-SQL Script like this:


if @i != 0
begin

set @state = 'ALBERTA'

Set @new_state = case @state
when 'ALBERTA' then 'AB'
else 'n/a'
end -- case
set @country ='CANADA'
end -- if

I've following Folding ID's

FoldID if
FOLD_BEGIN begin
FOLD_END end


FoldID case
FOLD_BEGIN case
FOLD_END end

The end for the if-statement will not be recognize in this case.
I hope anyone can help me.

Thanks
Ronald
User avatar
Rickard Johansson
Site Admin
Posts: 6628
Joined: 19 Jul 2006 14:29

Post by Rickard Johansson »

Try to set the fold option for "case" to

FoldID=case
FOLD_BEGIN=
FOLD_END=end
taucher1
Posts: 5
Joined: 21 Apr 2009 10:52

Post by taucher1 »

:(
No, it will not work.

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

Post by Rickard Johansson »

I just tried to add this to the SQL syntax:

[Fold]
1_Id=if
1_Begin=begin
1_End=end
1_EndBefore=
1_Section=
1_NoParentOfId=0
1_ListItem=
2_Id=case
2_Begin=
2_End=end
2_EndBefore=
2_Section=
2_NoParentOfId=0
2_ListItem=

I used the syntax editor and RJ TextEd v5.01.

The code

if @i != 0
begin

set @state = 'ALBERTA'

Set @new_state = case @state
when 'ALBERTA' then 'AB'
else 'n/a'
end -- case
set @country ='CANADA'
end -- if

folds just fine. Both the case and if statements are folded properly.
taucher1
Posts: 5
Joined: 21 Apr 2009 10:52

Post by taucher1 »

Hi Richard,
sorry for late answer.

I've got this fold (It tooks the first case --end and not the end --if)

if @i != 0 ...
set @country ='CANADA'
end -- if


and not

if @i != 0 ...

Syntax:

PostPosted: Sat Apr 25, 2009 5:26 pm Post subject:
I just tried to add this to the SQL syntax:

[Fold]
1_Id=if
1_Begin=begin
1_End=end
1_EndBefore=
1_Section=
1_NoParentOfId=0
1_ListItem=
2_Id=case
2_Begin=
2_End=end
2_EndBefore=
2_Section=
2_NoParentOfId=0
2_ListItem=

with RJ TextEd v5.01
taucher1
Posts: 5
Joined: 21 Apr 2009 10:52

Post by taucher1 »

Hi,
in v5.10 it will work correctly :)
User avatar
Rickard Johansson
Site Admin
Posts: 6628
Joined: 19 Jul 2006 14:29

Post by Rickard Johansson »

I guess I made a small change somewhere in the folding code, but I can't remember where right now... I'm glad it works now :D
Post Reply