Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Make dapper SQL be syntax colorized

If one were bound and determined to get Dapper SQL strings in a C# project syntax colorized in Visual Studio (and for a bonus, syntax checked or even intellisense-capable!), how would one go about it?

Some wild ideas I had:

  • Create a new language that is in reality C#, but has just enough differences to support inline SQL somehow (not inside double quotes).
  • Make a Visual Studio plugin (or modify the attendant VS code some way) that at some point manages to get code colorization in.

Who knows what other options there might be.

I get that achieving my objective could be very costly in terms of effort, time, resources, etc. I'm asking from the perspective of, if you had those resources, what would it actually take?

like image 691
ErikE Avatar asked Oct 29 '13 20:10

ErikE


1 Answers

There is already a Visual Studio Add In for doing this. Check it out!

From their site:

This Visual Studio 2010 extension adds basic SQL syntax highlighting (keywords, functions and variables) to string literals.

In addition, you can get the source code and customize it anyway you feel fit to (including adding specific Dapper keywords).

like image 52
Icemanind Avatar answered Oct 15 '22 05:10

Icemanind