Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Prevent Visual Studio 2015 from removing line continuation characters (_) in VB.NET files

I'm opening some old VB.NET projects in Visual Studio 2015 and when I edit the code, VS changes the syntax:

It removes "_" in concatenations:

'Before
myString = "ABC" & _
           "DEF"

'After
myString = "ABC" & 
           "DEF"

or add a space before !:

'Before
myDatatable.Rows(0)!myColumn

'After
myDatatable.Rows(0) !myColumn

This syntax isn't compatible with Visual Studio 2010 or 2013.

How can I disable this changes?

like image 636
Paolo Crociati Avatar asked Aug 07 '15 09:08

Paolo Crociati


1 Answers

I had the same problem, and I was able to fix it by disabling the "Pretty listing" option in the editor. You can find this option here:

Tools > Options > Text Editor > Basic > Advanced > Editor Help > Pretty listing (reformatting) of code

I'm not sure what other auto-reformatting this option disables, but at least the editor stopped removing the line continuation characters in old code/projects.

PS: While the Roslyn team says they fixed this (see links below), this bug is still present in the latest version of Visual Studio 2015.

edit Link to bug report - Link to merged fix (copied from first comment on original question)

like image 88
RiptoR Avatar answered Sep 28 '22 21:09

RiptoR