Hello,
I would like to suggest an improvement for Xojo 2026.
Currently, Project > Analyze Project can detect some unused items, such as unused local variables and unused method parameters. However, it does not seem to detect unused project-level items, such as:
- methods that are never called
- unused properties
- unused constants
- unused modules or classes
- unused global variables
It would be very useful to have a more complete analysis option, for example “Find Unused Project Items”, that could list project items that appear to be unused.
I understand that there could be false positives, especially with introspection, callbacks, delegates, dynamic calls, or framework/plugin usage. But even a “potentially unused” list, with a way to ignore or suppress specific items, would be very helpful when cleaning up older projects.
Thank you,
Eric Plourde
3 Likes
I like this idea and it looks like there is already a feature request in the tracker that isn’t too old.
https://tracker.xojo.com/xojoinc/xojo/-/issues/80363
Give that one a thumbs up and add some more details to give it some traction.
2 Likes
save your project as text (i.e. xojo project) it will be stored in a folder
give an AI access to this folder
and ask the AI to look for unused items
most of the AI will find them for you with very little false positive.
and you can ask the AI to remove them from your project
they will do it without breaking the syntax.
ps: pretty sure Jade may not get them though …
That is just about the least reassuring thing I’ve ever read. The AI will delete items from your project with only a minimal chance of trashing something valuable. Sign me up!
2 Likes
that is just as easy to solve: just compile again !
if there are errors, the AI did mistakes
show it the errors, and ask it to fix them
that’s also what git repo are for. save the project before.
and if you want it to not change anything, just give it only read access
and apply the changes yourself
1 Like
That’s a good point. Once you loop in the Introspection system, you eliminate a lot of possible checks that can be performed on property usage, method calls, etc. The good news is that you can’t instantiate a class except by the New operator followed by a code literal identifying the class (ie, you can’t use a variable) so at least the system can still check for unused classes, and that’s a big win.
In fact, as far as I understand it, the linker/compiler already does this, so it should be a relatively simple matter to surface the results of that process to the user.
Operator overload methods can instantiate classes implicitly.
Class Foo
Sub Operator_Convert(From As Integer)
End Class
Dim f As Foo = 1
1 Like
That guy isn’t very bright. You always need to make sure you have multiple backups. Does AI foobar the code occasionally? Sure, but that’s what version control is for.
2 Likes
Well, look at that. Thanks, I never thought of that pathway.
This is kind of wrong. You can use GetTypeInfo(ClassName) to get the data for the class without needing an instance. You can then interrogate the constructors and invoke the one you need. But at the end of the day, you do still need the literal somewhere. So it’s more like six of one, half dozen of the other.
If we could ever do GetTypeInfo(“ClassName”) then we’d be able to have a lot of fun.
It’s a trick I had used on a project I inherited where the previous dev used introspection to serialize any class to JSON. It had a big giant select statement to create instances. While this doesn’t sound terrible, it meant that there was no opportunity to refactor anything and still make the legacy data loadable. Once a property was removed, renamed, or changed type, its data was essentially gone. So instead of the select statement, I made a dictionary from the TypeInfo objects, then look for a constructor that takes a JSONItem. If it exists, that is called to deserialize. If not, the plain constructor is called and the introspection-based deserialize routine is used.
This isn’t a design a particularly like but it did give me a path forward without having to rewrite the entire saving system.
2 Likes
Claude deleted all the backups, even though it wasn’t supposed to. You can put all kinds of rules in place, and AI can still completely ignore them and do whatever it wants.
This isn’t the first, or even second time Calude has destroyed work like this.
Not trying to defend Claude or anything, but the first mistake was granting it write access.
4 Likes