I suggest you ...

Add Syntax Highlighting/Intellisense inside SQL Strings in C-Sharp/VB Files

The SQL Server Database Tools and SQL Server Management Studio tools are excellent, but it would be super helpful if Visual Studio also did SQL syntax highlighting and intellisense inside of SQL strings in files other than those with .sql extensions. Namely, C-Sharp and VB files.

Doing simple queries with an inline string is an incredibly common pattern, so actually having some intellisense and/or compilation warnings would be great.

This would enable a much more efficient development story for cases where using something like Dapper.net is preferable over a heavier OR/M like EntityFramework.

96 votes
Vote
Sign in
Check!
(thinking…)
Reset
or sign in with
  • facebook
  • google
    Password icon
    Signed in as (Sign out)
    You have left! (?) (thinking…)
    Brad Westness shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →

    5 comments

    Sign in
    Check!
    (thinking…)
    Reset
    or sign in with
    • facebook
    • google
      Password icon
      Signed in as (Sign out)
      Submitting...
      • Dylan Nicholson commented  ·   ·  Flag as inappropriate

        There is a plug-in that does this, namely SqlSyntaxHighlighting, but the original version and the one on the marketplace is only for VS 2012 and earlier. There's a fork in github that does in fact build a working version for VS 2017, and I've tried it out, seems to work well.

      • Anonymous commented  ·   ·  Flag as inappropriate

        Add the following to the application process
        Gold coin bill introduct to twenten usaol. ...

        GASESES BUHOMS INKESOMA INOMSA

      • Claude Adrian commented  ·   ·  Flag as inappropriate

        Not only SQL highlighting but also code lens inside the SSDT project showing you references to the C# file/line where the name of the sproc or table/view was noticed inside a string. They could even add a new type of string literal for sql queries that would be scanned if a SSDT project was found in the solution.

      Feedback and Knowledge Base