Special highlighting for dynamically defined symbols

SyntaxEditor for WPF Forum

Posted 10 years ago by Theresia Hansson
Version: 10.1.0522
Avatar
Hi there,

I have two related questions that I hope for some kind soul to know the answer too.

1) I would like to have special highlighting for user defined class names and function names. So if the code contains:

class MyClass
{
    public void DoSomething()
    {
    }
}
Then everywhere in the editor the identifier token MyClass should have one style, while the identifier token DoSomething should have another. Unknown identifiers should have error markings.

Is this possible and how would I go about implementing such a solution? I just bought WPF studio and started having a look at Syntax Editor today so I'm not a pro. But I can't seem to find anything like this in the samples or in the documentation. I would be truly greatful for an outline of the basic steps needed to do this so I can continue digging where needed.

2) Also, is there a way to have different documents communicating with each other so if I have defined a class in one document it would be available in another? Like in a Visual Studio project.

Comments (2)

Posted 10 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Theresia,

We have a .NET Languages Add-on that provides automated IntelliPrompt based on assembly/project references like in VS however it is for the WinForms SyntaxEditor only and is not yet available for the WPF SyntaxEditor. We are working towards adding the features needed to port it over though so that will eventually be available in WPF too.

To do special highlighting like what you requested you'd need:

1) Something to tell you which identifiers should be custom highlighted. This is generally some sort of parser that examines your document and makes a symbol table. For complex languages this is not a simple task and could take many hours to build.

2) Something to highlight the words based on that symbol table data. We have some QuickStarts that show how to use classifiers to custom highlight words. You'd use that technique based on data from the step #1 that you obtain.


Actipro Software Support

Posted 10 years ago by Theresia Hansson
Avatar
Hi, thank you for your reply.

As for C#, I was only using that as an example. I am actually going to use SyntaxEditor for Lua, Python, and HLSL so I guess I would have to do a custom solution anyway if it will only be supported for .NET. That is absolutely fine by me and in that case I can also see how it could work to parse multiple documents/files.

I'll let you know how it goes.
The latest build of this product (v2019.1 build 0683) was released 1 month ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.