The rule "the project's own units first, then the folders in search order, the first file of each name wins" is implemented three times:
TUnitFileIndex in GX_GrepBackend.pas, for Grep's map file searchOta.TryFindPathToFile and Ota.TryFindProjectModuleFile in GX_OtaUtils.pas, for the Uses Clause Manager, Project Dependencies, Open File and othersTUnitExportParserThread in GX_UnitExportsParser.pas, for the Identifiers tab of the Uses Clause Manager and Declare Variable, since the fix for bug [#554]They already differ in details:
TUnitFileIndex includes hidden files found in the folders, the parser thread skips hidden, system and temporary files and symbolic links.TUnitFileIndex and Ota.TryFindProjectModuleFile check that a project file exists with FileExists, the parser thread reads its attributes.Ota.TryFindPathToFile checks one name at a time with FileExists for each folder, the other two list the folders once.Every future change to the rule has to be made three times, or the experts resolve a unit to different files.
Possible fix: one shared index in a unit that does not use the ToolsAPI, filled from a list of the project's files and a list of folders, so the parser thread can use it as well.
Found in a code review of the fix for bug [#554].