有时我更喜欢在声明变量后添加注释。例如:
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的评论中添加换行符,以便工具提示显示多行?
答案 0 :(得分:0)
目前评论和工具提示都很长或者都是多线的。如果有一些标记(\ n,< br />或类似的东西)在这里有更好的控制,那将是很好的。或者您可以指定此类工具提示的最大宽度的选项也可以解决您的问题。
作为一种“解决方法”,我建议即使变量名称变长也要尽量缩短注释。如果变量是不言自明的,这甚至支持代码的可读性