The better way to provide syntax highlighting for your own PSI

I am writing a plugin to support a new language in ReSharper and I found that writing a highlighting daemon stage does not bring the suffice result in syntax highlighting. The thing is that the highlighting created this way disappears for the time the user is typing.

For example, when the user starts changing a string literal node marked with orange ('String') highlighting it turns black for a moment and then again turns back orange. It is acceptable, PSI plugin follows this approach in particular, but I'm still looking for a better solution because I know that syntax highlighting for the languages like C# does not have this flaw.

May be somebody has an idea how it works in C# or how to fix it another way?

Comment actions Permalink

Since ReSharper is a plugin to Visual Studio, and supports the file types that VS supports, it relies on Visual Studio's language services to provide syntax highlighting, and it's own highlighting system is really intended for highlights (errors, warnings, TODO items and some keywords) rather than as-you-type syntax highlighting of a language. Which means that the smoothest way to get syntax highlighting for a custom file type right now, is to implement a Visual Studio language service, sadly.

I've added a feature request to the tracker, would you be able to add a comment explaining what you're doing and the results you're seeing, please? (And vote for it!):


Comment actions Permalink

Thanks for clarification, Matt.
I've commented the request, hope it will be implemented some day.


Please sign in to leave a comment.