2

有时我更喜欢在声明变量后添加注释。例如:

bool isOverhwndChild1; // This is just an example to make my question clear and you can understand.
bool isOverhwndChild2; // This is just an example to make my question clear and you can understand.
bool isOverhwndChild3; // This is just an example to make my question clear and you can understand.
bool isOverhwndChild4; // This is just an example to make my question clear and you can understand.

我安装了Visual Assist X.

如果我将鼠标移到这些变量上,则会出现一个工具提示并显示注释。但是如果注释很长,工具提示的宽度就会很大。

我不想这样写,因为它分散了我对变量声明的注意力:

// This is just an example
// to make my question clear
// and you can understand.
bool isOverhwndChild1;

// This is just an example
// to make my question clear
// and you can understand.
bool isOverhwndChild2;

// This is just an example
// to make my question clear
// and you can understand.
bool isOverhwndChild3;

// This is just an example
// to make my question clear
// and you can understand.
bool isOverhwndChild4;

有没有办法在 VS2010 的注释中添加换行符,以便工具提示显示多行?

4

1 回答 1

0

目前,评论和工具提示都很长,或者都是多行的。如果有一些标记(\n、< br /> 或类似的东西)在这里有更好的控制,那就太好了。或者您可以指定此类工具提示的最大宽度的选项也可以解决您的问题。

作为一种“解决方法”,我建议即使变量名变长,也要尽量缩短注释。如果变量是不言自明的,这甚至支持代码的可读性

于 2013-02-01T10:21:59.600 回答