Visual Studio-每个新文件末尾的空白行 [英] Visual Studio - blank line at the end of each new file

查看:328
本文介绍了Visual Studio-每个新文件末尾的空白行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么VS在我创建的每个新文件的末尾添加空白行?我使用VS创建.NET项目(不是C ++或其他).

Why does VS add a blank line at the end of each new file I create? I use VS to create .NET projects (not C++ or something).

有什么特殊原因吗?与编译器和解析器有历史兼容性吗?

Is there any special reason? Historical compatibility with compilers and parsers?

我可以禁用它吗?

推荐答案

为了便于浏览,建议在每个文件的末尾都有一个空白行.想想如果有人用例如vim打开您的代码并使用键盘映射从空行跳到空行会发生什么.或者,如果他决定在文件末尾添加另一部分代码,则可以快速执行GO并输入它,而不必滚动到文件末尾.

It is recommended to have a blank line at the end of each file for navigability purposes. Think what happens if someone opens your code with vim for example and uses a keymap to jump from empty line to empty line. Or, if he decides to add another portion of code at the end of file he can quickly do a GO and enter it instead of having to scroll until the end of file.

此外,如果您尝试在文件末尾插入代码时没有尾随空白行,则源代码管理工具将报告更多更改.

Also, source control tools will report more changes if you don't have a trailing blank line when you try to insert code at the end of file.

这篇关于Visual Studio-每个新文件末尾的空白行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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