阻止Visual Studio 2015删除VB.NET文件中的行继续字符(_) [英] Prevent Visual Studio 2015 from removing line continuation characters (_) in VB.NET files
问题描述
我在Visual Studio 2015中打开一些旧的VB.NET项目,当我编辑代码时,VS更改了语法:
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"
或在!:
'Before
myDatatable.Rows(0)!myColumn
'After
myDatatable.Rows(0) !myColumn
此语法与Visual Studio 2010或2013不兼容。
This syntax isn't compatible with Visual Studio 2010 or 2013.
如何禁用此更改?
推荐答案
我遇到了同样的问题,可以通过在编辑器中禁用漂亮列表选项来修复它。您可以在此处找到此选项:
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:虽然Roslyn小组说他们已解决此问题(请参见下面的链接),但该错误仍存在于最新版本的Visual Studio 2015中。
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 链接到错误报告- 链接到合并修订(摘自对原始问题的第一条评论)
edit Link to bug report - Link to merged fix (copied from first comment on original question)
这篇关于阻止Visual Studio 2015删除VB.NET文件中的行继续字符(_)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!