I put together a small Delphi FireMonkey project called UnitResolver which allows you to enter a class, function, or procedure name and then does a search via Google Custom Search to see if it can predict what Unit that class/function/procedure is in so that you can add it to the Uses clause of your current Unit. The Delphi IDE has a built in function that does this to a certain extent if you select some text and press CTRL-SHIFT-A but for the most part I have never found it to give very good results. In the UnitResolver project I have Google Custom Search set up so that it only searches docwiki.embarcadero.com (you can try this yourself in the regular Google search by adding site:docwiki.embarcadero.com to the end of your search). I have the Google Custom Search results piped through a PHP page on FMXExpress.com so keep my Google API key secure. I used the REST Debugger to automatically consume the JSON from Google Custom Search and load it into a TFDMemTable automatically. Lastly, I use the Levenshtein distance algorithm (which is a fuzzy matching solution) to try and predict which of the results is closest to the correct unit. Feel free to test it out and see how well it does finding units for classes, functions, and procedures in the Delphi RTL.



Download the full source code for the UnitResolver project for Delphi 10.2 Tokyo.