LabVIEW Idea Exchange

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

Unused Code Highlighting

Status: New

Is it possible to have a feature to quickly identify *.vi's and *.ctl's that are in the project tree but not used in your code anywhere?  Maybe the VI name could have a different color for the text or some other indictor for unused code?  This could also be a configurable option - you could have the ability to turn the highlightin on/off.

12 Comments
tst
Knight of NI Knight of NI
Knight of NI

You should already be able to right click somewhere in the project (probably on the target, which is usually My Computer) and select Find items with no callers, which I think should do what you want. Try it and see if it's good enough.


___________________
Try to take over the world!
DCSmith
Member

"Find items with no callers" does partially do what I want.  The problem is everytime I click "goto" or double click an item to find it in the tree, the window closes then I have to re-click the target (My Computer) then re-right click and re-select "find items with no callers" and look through the list of items.  Also, the "find items with no callers" window is not resizeable so you have to do some manipulating to see the entire path/filename of the VI's in the list. 

 

It would be nice if you could just quickly identify unused items by looking at the project tree.

tst
Knight of NI Knight of NI
Knight of NI

There should already be an idea here for handling these project windows so that they don't close.


___________________
Try to take over the world!
DCSmith
Member

If that were implemented, it would definitley make the function a lot more user friendly, but why not just go the extra step and make the unused items visible from the project tree rather than having 1 more window to deal with?

Wart
Member

I like this idea.  I've been handed several large projects with heaps of unused VIs in the past.  Even the proposed changes to the project windows wouldn't be as simple as this.

It might be nice to have a way to just remove all unused VIs too.  Though that might cause issues.

pRoFiT
Member

Not a bad idea.

 

As a side note, i have a couple apps that dynamicly load subvi's. They are in the project but are not linked directly in any other subvi. These subvi's would most likly show up unused as well. So it wont always tell you what subvi's are not used in the final application.

 

Wont you main app also show as having no callers?

- A minute saved is a Minute earned!
AristosQueue (NI)
NI Employee (retired)

A work around that I often use -- select everything in the project except my top-level VI(s) and choose "Remove From Project". Anything that really isn't used will fall out of the project. Everything else will just move down to Dependencies. Then I select all the Dependencies except vi.lib and move them back into the project. Works great unless the project is using Autopopulating Folders, but I don't ever use those.

 

PS: This is, as I said, a workaround for today. The idea is a good idea for the future.

DCSmith
Member

I wish that worked with Autopopulating folders because I use them almost exclusivley.

AristosQueue (NI)
NI Employee (retired)

> I wish that worked with Autopopulating folders because I use them almost exclusivley.

 

For you, good sir, we have a special on App Builder: Build Source Distribution -- you put your top level VI into the build spec, ask it to build, then delete your original source files and copy the results of the build back in place. Viola -- all the files that aren't used by your project are deleted and now you may continue to use your autopopulating folders.

DCSmith
Member

Point taken Smiley Very Happy