This is a prototype for adding syntax highlighting to SQL inside of C# strings. It leverages internal extensibility points of Roslyn by forking parts of Roslyn and parts of ASP.NET Core--their route pattern syntax highlighting. It uses the SQL ScriptDOM library for parsing SQL. The code is inside SqlClassifier.cs.
To test the highlighting in Visual Studio, build the solution then run install.cmd
as an administrator. Then create an ASP.NET Core project targeting .NET 8.0. After that, it should work on APIs annotated with [StringSyntax("Sql")]
.
This code is very brittle and was created for a hackathon. It is hard-coded to VS 17.8 Preview 2 and .NET 8.0 RC 1.