2

有时我更喜欢在声明变量后添加注释。例如:Visual Studio 2010中的工具提示

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

用什么语言? – SLaks

+1

我似乎没有这个功能。你说当你将鼠标悬停在一个变量名上时,它显示你在它声明的行上的评论? –

+1

啊,对此抱歉。我安装了VAssistX,评论的工具提示是它的一个功能,而不是VS2010。 – user565739

回答

0

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

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

相关问题