VB.Net formatting template

Hi All

I only came across ReSharper yesterday and so far I think it's really good. I have been playing around with a template to use for VB.Net in Visual Studio 2010 and can't quite get it to format correctly. What I am trying to achieve is the following layout:

    Const DetailsSql =
        "SELECT " &
               "Product.ID " &
        "FROM Product " &
               "INNER JOIN ProductSubGroup " &
                            "ON ProductSubGroup.ProductID = Product.ID " &
        "WHERE Product = 12345 "


The reason is that my boss likes her code lined up like this, for example the right side of "JOIN" must align with "ON" and so on. I've written a template which almost gives me the layout but does not indent the lines correctly. The Template looks like this:

Const DetailsSQL = _
     "SELECT " & _
          "$var$.$var2$ " & _
     "FROM $var$ " & _
          "INNER JOIN $var3$ " & _
                  "ON $var3$.$var$$var2$ = $var$.$var2$ " & _
    "WHERE $var$ = $var8$ "


It works perfectly in terms of filling in the variables but the layout in the VB code apears left aligned like this:

    Const DetailsSQL =
        "SELECT " &
        "var.var2 " &
        "FROM var " &
        "INNER JOIN var3 " &
        "ON var3.varvar2 = var.var2 " &
        "WHERE var = var8 "


Is there an option anywhere I can set which allows the code to align exaclty as I've written it in the template? Any help would be greatly appreciate.

Thanks

Rich

1 comment
Comment actions Permalink

Hi Rich,

the formatting you show looks like the default formatting of the VB Editor. You can turn this off in the options to get R#
formatting (or run R#'s code cleanup, but the format will be overwritten the next time you alter the code). You have a much more
fine grained control of formatting in the R# options, but there is no option to format SQL statements, which are embedded as strings.

Regards
Klaus

0

Please sign in to leave a comment.