cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
mann
Level III

Code Folding is catching too many lines

I have set "if" blocks to be foldable, 

and I have been using them like this 

 

If (1==1, // comment abc
   <foldable code block 1 > );
If (1==1, // comment xyz
   <foldable code block 2 > );

 

But often, the first block will catch later blocks and fold them all together.

 

The code work without a problem, but is is sometimes hard to find the code, it is lost in the folds.

Is there a solution to this issue?

5 REPLIES 5
Jeff_Perkinson
Community Manager Community Manager

Re: Code Folding is catching too many lines

I've tried to reproduce this behavior and I've not be able to.

 

What version of JMP are you using?

 

Can you provide an example of JSL that causes a problem?

-Jeff
jthi
Super User

Re: Code Folding is catching too many lines

I have had same issue (with JMP15.2.1). 

 

I managed to repeat it but I'm not sure how reliable this is:

 

1. Start with:

Expr(
	if(
		//example inside here IF
		//example inside here IF
		//example inside here IF		
	);
	//example inside here EXPR
	//example inside here EXPR
	//example inside here EXPR
);

2. Remove ); from row 6:

Expr(
	if(
		//example inside here IF
		//example inside here IF
		//example inside here IF		
	//example inside here EXPR
	//example inside here EXPR
	//example inside here EXPR
);

3. Press enter on row 5 and add new if statement:

Expr(
	if(
		//example inside here IF
		//example inside here IF
		//example inside here IF
	if(
		
	);
	//example inside here EXPR
	//example inside here EXPR
	//example inside here EXPR
);

4. Remove new If( but leave );

Expr(
	if(
		//example inside here IF
		//example inside here IF
		//example inside here IF		
	);
	//example inside here EXPR
	//example inside here EXPR
	//example inside here EXPR
);

Images starting from part 3:

new if:

jthi_0-1616563525669.png

new if removed (something weird going on with code folding square):

jthi_1-1616563535366.png

afte re-opening script:

jthi_2-1616563612382.png

 

At least in this case seems like the code folding doesn't get properly updated if something is removed from the middle of code. For me it resolves usually by either rebooting JMP or just be closing and re-opening the script.

-Jarmo
Georg
Level VII

Re: Code Folding is catching too many lines

I've also seen examples of "not so clear" code folding (JMP Pro 15.1, Win10)
But I pretty much like autoformatting, to also see if my syntax is correct, and to hopefully avoid these problems.

When doing so (pressing Crtl-m) I never experienced code folding problems. So may be this is a "workaround"?

Georg
mann
Level III

Re: Code Folding is catching too many lines

Thanks for all the help, I have found that restarting JMP will "refresh" the folding tags, and scripts will open properly.

But continued use will confuse JMP again, and the folds will begin folding multiple sections at once.

ErraticAttack
Level VI

Re: Code Folding is catching too many lines

The JMP editor definitely has some quirks -- with this one in particular, the quickest fix (and it doesn't require restarting JMP) is to use the "Reformat Script" button just right of the "Run Script" button -- reformat the script (I then immediately undo, as I usually prefer my own format) and the code folding will get reset properly.

Jordan