Author |
Topic |
|
EnricoGasperoni
New Member
2 Posts |
Posted - Oct 09 2017 : 9:24:05 PM
|
My company has a strict "no auto" rule. It would be great if there was an option to tell VA to avoid using auto when generating code.
My main use case is when code inspection converts a regular for loop into a range based for loop (awesome feature by the way) and it always makes the variable auto, and I always have to go change it afterwards.
Thanks, Enrico |
|
feline
Whole Tomato Software
United Kingdom
19014 Posts |
Posted - Oct 10 2017 : 07:26:13 AM
|
We are looking to add a refactoring command to expand the auto into it's full type:
case=79735
which should help here. For now, are you aware that if you place the caret into a symbol, the VA Definition field (at the top of the editor, where the Alt-m list appears) will show you the full definition, including the expanded type. You can then copy the type from here, which can make it quicker and easier to look up the type when removing auto from your code. |
zen is the art of being at one with the two'ness |
|
|
EnricoGasperoni
New Member
2 Posts |
Posted - Oct 10 2017 : 7:21:12 PM
|
Thank you for pointing that auto, I hadn't noticed it and I can see how seeing the type is a pretty useful feature. However in my case it doesn't help much because the type is explicitly written before Code Inspection converts the for loop so I know that already. For me it is about the hassle of having to "fix" the result of Code Inspection every time I change a for loop. If Code Inspection would allow me to opt out from auto, even just for converting for loops, that would make the conversion a one step task for me (which is what CI is trying to do).
Thanks for the quick reply, and thanks for making Code Inspection, it's pretty awesome :) |
Edited by - EnricoGasperoni on Oct 10 2017 7:21:59 PM |
|
|
feline
Whole Tomato Software
United Kingdom
19014 Posts |
Posted - Oct 11 2017 : 08:56:01 AM
|
That's fair. The convert auto refactoring command would help, but it's not really the same. I have put in a feature request not to introduce auto when converting a for loop into a range-based loop:
case=111640 |
zen is the art of being at one with the two'ness |
|
|
|
Topic |
|