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 />或類似的東西)在這裏有更好的控制,那將會很好。或者,您可以指定這種工具提示的最大寬度的選項也可以解決您的問題。

作爲一種「解決方法」,我建議儘量縮短評論,即使變量名稱變長。如果一個變量不言自明,這甚至支持代碼的可讀性

相關問題