LabWindows/CVI Idea Exchange

cancel
Showing results for 
Search instead for 
Did you mean: 
jdubs

Auto Indent Code

Status: Completed
Introduced in LabWindows/CVI 2013

While developing code, having correct indentations is very helping in making sure you have all the right brackets and to see where your structures are nested easily.  Sometimes, whether by copying and pasting or just rapidly getting out a section of code, a whole segment might have incorrect indentation, which is tedious to correct.

 

This is where an auto indent tool could be a big time saver.  From somewhere like the Edit menu, where similar functionality is located in other development environments, you could select Format Selection to do a highlighted section or Format File to do the whole file.  Then, CVI can format the tabs for you:

 

autoindent.png

 

Although this is a simple example, auto indent becomes even more useful when you have multiple nested structures and decide, for instance, to add or remove another nested loop.

5 Comments
LuisG
NI Employee (retired)
Status changed to: Under Consideration
 
SteveD123
Member
dubs, you state that "a whole segment might have incorrect indentation, which is tedious to correct". Are you aware of a programe called "Artistic Style" that will do this for you? It can be found at http://astyle.sourceforge.net/ It is under the GNU lesser GPL V3, so it could be included in a CVI distribution. From the website: "Projects that use Artistic Style do not have to make the source code available. If Artistic Style itself is modified, however, the modified Artistic Style source code must be made available."
JonathanN
NI Employee (retired)
Status changed to: In Beta
 
Jonathan N.
National Instruments
Wolfgang
Trusted Enthusiast

This is really a very nice feature, thanks a lot for implementing it!

JonathanN
NI Employee (retired)
Status changed to: Completed
Introduced in LabWindows/CVI 2013
Jonathan N.
National Instruments