I want to build DotHTML language plugin for R# (and Rider of course). The language is based on top of HTML and is similar to Razor. It's used in DotVVM web application framework. The problem is... I have no idea where to start and docs are not very helpful. I'd like to reuse as much of existing solutions as possible (eg. language injections, prefixed HTML elements). I hope you can answer my questions.
1) How to build Lexer
I guess it would be best to use the HtmlCompoundLexer which accepts baseLexer as second parameter. But I can't figure out how should it work. Is the baseLexer supposed to handle just parts that can't be handled by the underlying HtmlLexer? Can such lexer be generated with the CsLex tool? If so, would you mind sharing grammar for Razor lexer as an example?
2) How to handle parts with special meaning
The DotHTML language have some parts with special meaning:
- Prefixed HTML elements. Similar to Razor tag helpers or ASPX controls.
- Binding expressions. Special HTML attribute value containing limited C# expression.
- Directives similar to Razor directives (@model, @using, etc.).
Are there any services I can use to implement these features? How to build custom IntelliSense?
3) How to enable Syntax coloring
Does R# handle syntax coloring in any way? Or does it rely entirely on Visual Studio? How will it work in Rider?