防止 Visual Studio 2015 删除 VB.NET 文件中的行继续符 (_) [英] Prevent Visual Studio 2015 from removing line continuation characters (_) in VB.NET files

查看:33
本文介绍了防止 Visual Studio 2015 删除 VB.NET 文件中的行继续符 (_)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 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:

它在串联中删除_":

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

'After
myString = "ABC" & 
           "DEF"

或在 ! 前加一个空格:

or add a space before !:

'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 Link to bug report - Link to merged fix (copied from first comment on original question)

这篇关于防止 Visual Studio 2015 删除 VB.NET 文件中的行继续符 (_)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆