Getting rid of left sided commas

by alski 17. May 2006 21:41

Left handed commas are a standard where I work in the SQL. I think this causes some funky formatting in Visual Studio (.Net)

Consider some SQL

  SELECT Field1
, Field2
, Field3
, Field4
, Field5
, Field6
, Field7
FROM SomeTable

Note the left-sided comma.

Now consider that you might wish to have an enum of the column names (in this case we don’t actually care about the order, we just use the enum to hold the name). So in Visual Studio, create the enum and paste in the column names

public enum TableQuoteFundColumns
{
Field1
, Field2
, Field3
, Field4
, Field5
, Field6
, Field7

Now close the curly bracket ‘}’ and watch VS autoformat.

public enum TableQuoteFundColumns
{
   Field1
      , Field2
         , Field3
            , Field4
               , Field5
                  , Field6
                     , Field7
}

public enum TableQuoteFundColumns
{
   Field1
      , Field2
         , Field3
            , Field4
               , Field5
                  , Field6
                     , Field7
}

I think this has to be due to the left-sided commas… Any suggestions???

Update

If you use SearchAndReplace (ctrl-h) and Use RegularExpressions then you can fix it with

Find What:         \n[ \t]*,
Replace With:     ,\n\t

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

Powered by BlogEngine.NET 1.4.5.0
Theme by Mads Kristensen

RecentComments

Comment RSS