I’ve been searching and can’t seem to find this anywhere.
In the Eclipse IDE, you can select an item, and find out where in your code that item is referenced. For instance, for a function, it will list all the calls to that function.
In Xojo, I don’t see this capability. There is Right-Click Find ‘text’. But that finds text, not references.
You can delete, compile (Project/Analyze Project), then undo if there is an error. That is really tedious.
Any other ways to find out what code in your project is not being used?
if you right click, there is a GO TO method, which will jump to where that method is defined
BUT NOT the other way around
There are 3rd party tools that analyze you code… but if I recall, DEAD code is not compiled,nor included in the final package (but I may be mistaken here)
Easier than deleting is changing the name slightly, then running Analyze, e.g., “MyMethod” -> “MyMethod_test”. But that and Find are your options.
As Dave mentions, some dead code is stripped, but not all. As it was explained to me, this is so that Introspection can access methods that might otherwise not be referenced anywhere else.
OK thanks. Just needed to confirm I wasn’t wasting too much time on this process.
The point is to have the code well organized and thus maintainable. So dead code stripping by the compiler doesn’t help.
I used this feature so much when using Eclipse, that I would suggest this is a good feature to add for a future release.
The other one that is really useful is Refactor, which is like search-and-replace though again not limited to the text. If you have MyFunction and MyFunction1, then Refactor of MyFunction to MyFunction2, would not change MyFunction1 to MyFunction21 (which is what search-and-replace would do). If that makes any sense!
Another way to do this is to set the “deprecated” attribute for the method and then Analyze Project. The method in question will show up in the deprecations list.
Outside of this, that’s a good way to change your code, especially shared code, slowly. Type in “deprecated” then put in what replaces it in the Value column. When you analyze, you will get a message like, “MyMethod has been deprecated. Use NewMethod instead.”