LabWindows/CVI

取消
顯示結果 
搜尋替代 
您的意思是: 

auto indent

已解決!
前往解決方案

How do I have to set my bracket style / auto indent options to not have the following formatting affected, i.e. selecting the text and applying 'Format Selection' should not change anything (because this is the way I would like to have it formatted):

 

before.png

 

Right now, what is happening it the following:

 

after.png

 

I think that this indent behaviour is not consistent; for example, it does reformat the second line of MemoryAllocateDynamicMemoryStringArray, while it keeps the second line of MemoryCopyString unchanged...

 

Here are my settings:

 

formatting_options.png

 

Thanks!

0 積分
1 條訊息(共 11 條)
6,557 檢視

Hi Wolfgang

 

Looks like a interesting behavior. I could see the same in my CVI environment. The reason are the string length of the code. If you make it shorter, you get the behavior

like in Memory Copy String.  If your function name + space + ( are greater than 40 characters you get the appearance like in your long MemoryAllocated.... Function.

Is it smaller than 40 characters you get the appearance like in the MemoryCopy function.

 

I searched but I didn't found a way to change this. Sorry

Best regards
Bernhard

2 條訊息(共 11 條)
6,535 檢視

Thank you, Bernhard, for your investigations and the interesting result.

 

I am wondering if there is a significant reason to keep the 40 character limit - or if there is hope that this limit might be increased to say 80 characters in the future? 眨眼表情

0 積分
3 條訊息(共 11 條)
6,530 檢視
解決方案
由主題作者所接受 Wolfgang

Yes, there are plans to allow you more control over this. Can't promise exactly when, though 🙂

0 積分
4 條訊息(共 11 條)
6,495 檢視

Thank you Luis, this sounds promising.  高興表情

 

But you know that I am going to remind you 眨眼表情

0 積分
5 條訊息(共 11 條)
6,491 檢視

Oh, yes. I know it well 吐舌表情

0 積分
6 條訊息(共 11 條)
6,486 檢視

I don't know if I should call it unexpected behavior or missing feature 眨眼表情

 

autoindent treats C comments differently:

 

while it processes // as comment (as expected) it does not so for /*   */ (unexpected)

0 積分
7 條訊息(共 11 條)
6,431 檢視

Hi Wolfgang,

 

Can you give me an example of how // and /* */ are being treated differently?

 

Luis

0 積分
8 條訊息(共 11 條)
6,407 檢視

With pleasure...

 

some source code with both types of comments:

 

before.png

 

and after formatting the selection:

 

after.png

 

the // line is not moved, which is according to my Formatting Options, but the /* */ lines are...

0 積分
9 條訊息(共 11 條)
6,402 檢視

Okay, I see.

 

I understand that you'd like them to be consistent, but I'm not sure if your preference is that both styles of comments be moved, or that neither style be moved.

 

By default, the /* */ comments are moved to the same indentation level as the next statement, whereas the // comments are not moved at all, as you've seen. However, you can change the policy for the // comments by enabling the Indent Comment option in the Formatting Options dialog. If you do that, then both styles of comments will behave consistently: they will both be indented to the level of the next statement.

 

Unfortunately, if your preference is that neither style of comment be moved, then that option is not available.

 

Luis

0 積分
10 條訊息(共 11 條)
6,381 檢視