Hide some code lines for .NET syntax editor.

SyntaxEditor .NET Languages Add-on for WPF Forum

Posted 4 months ago by Daniel Fuentes
Version: 19.1.1
Avatar

I was trying to hidde some lines of the code in the syntax editor(not with region. I want not visible), but finally I was not able to find it a solution.

Ex.

using System;

namespace ExampleNamespace { --> not visible

public class Class1: Class2 { --> not visible
 
public void Method1(){
     int i = 0;
}
 
public void Method2(){
    int j = 0;
}
 
} --> not visible
} --> not visible
 
The idea is to keep the highlight of syntax working as expected.
 
Is it possible ? in case to be possible any clue?
 
Thanks in advance.
  

Comments (3)

Answer - Posted 4 months ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Daniel,

Based on your usage example, I think the solution you're looking for would actually be provided through the Code Fragments feature instead of trying to hide code in the editor. Code fragments allow you to define a header and footer that "wrap" the code in the middle and maintain the same parsing and syntax highlighting for the content in between.

Our Sample Browser has a QuickStart called "Code Fragments" that you can take a look at to see it in action. You can also find more detail documentation on the topic here.

Please reach back out if you do not think this will provide the solution you need and we can further discuss options for hiding code.


Actipro Software Support

Posted 3 months ago by Daniel Fuentes
Avatar

Hello,

Thanks for the reply, the problem in this solution is that for example is we want to add more usings we can not do as the region that we are adding these using is inside the class.

Is there any way to interleave different code fragments?

[Modified 3 months ago]

Posted 3 months ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Daniel,

SyntaxEditor supports header and footer text sections.  Anything can be in those header and footer text sections and they will "wrap" the document's text for the purposes of parsing.  Normally you would put your "usings" within the namespace declaration in the header text.

If you still think there is a problem for your situation, we would need more detail such as a code example showing how you are trying to break up the header/document/footer sections and what is in each.  Thanks!


Actipro Software Support

The latest build of this product (v21.1.2) was released 18 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.