【发布时间】:2016-01-24 05:37:48
【问题描述】:
有时当我在 Visual Studio 中评论我的代码时,我发现我的 cmets 拖到了我的其余代码之外。是否有任何快捷方式、方法或扩展可以将这些单行怪物重新排列为跨多行分布的格式良好的 cmets?格式化文档似乎不会影响 cmets。
比如说,我写了这么长的评论:
// If at this point the task has not completed it has exceeded the maximum time and a timeout exception should be thrown.
有什么简单的方法可以将其重新排列成类似以下的内容(除了手动)?
// If at this point the task has not completed it has exceeded the maximum
// time and a timeout exception should be thrown.
【问题讨论】:
-
我认为这是不可能的。需要考虑的一件事是,代码中的 cmets 通常被认为是代码异味(一个坏主意)。您确实应该将代码重构为更小的方法并适当地命名方法以显示您的意图。
-
谢谢@Andrew。我真的没有这么想过。 +1
-
我建议您阅读 Robert C Martin 的一本书,名为“清洁代码”,它将改变您对编码的看法。
标签: c# visual-studio visual-studio-2015 keyboard-shortcuts