gpt4 book ai didi

c# - 禁用 Visual Studio 2015 注释对齐?

转载 作者:太空狗 更新时间:2023-10-29 17:58:59 27 4
gpt4 key购买 nike

在 Visual Studio 2015 中,如果您有这样的代码:

var foo = that.Bar(); // Get the value
//foo++;

选择 Edit -> Advanced -> Format Document 结果格式如下:

var foo = that.Bar(); // Get the value
//foo++;

其中 Visual Studio 假设两个不相关的评论是相关的并将它们组合在一起。关系的假设是因为有连续的行,一行以注释结尾,下一行以注释开头。当然,这可以通过添加空行来解决,但这并不总是最佳选择,具体取决于特定代码。请注意,Visual Studio 2013 没有此功能。

我无法通过互联网搜索找到任何提及此功能的信息。这是 C#,Visual Studio 配置为保留选项卡。

有什么方法可以禁用自动格式化的这一部分吗?

最佳答案

我认为这是不可能的。我找到了 this post on GitHub其中一条评论提到了您的问题。 CyrusNajmabadi 写道:

Interestingly enough, we added some support to align comments over multiple lines. So, for example, in the example being mentioned, post format you end up with:

Comment alignment

Alignment is an interesting problem, and currently we have no support for alignment to happen with tabs when formatting between tokens. However, it gets more and more complex considering you might have these comments attached to items which themselves get moved around by formatting and thus may have their locations move to places that are not on tabstop boundaries.

关于c# - 禁用 Visual Studio 2015 注释对齐?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42005187/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com