First, you need to understand how the Spotlight data is collected.
When a file is copied or saved to a folder, a background mds process tries to collect its Spotlight data. It sees what kind of file it is, and then looks to see if it has a suitable importer – these are .mdimporter files, which contain code for extracting all the information from the file. There are built-in importers for some common file types, but not for AppleScript files.
Script Debugger ships with a Spotlight importer, which is loaded by the system. In the case of files saved by Script Debugger, this importer knows where to look to find the source – in bundles it’s in main.recover.rtf, and in .scpt files it’s saved as a resource using the Carbon resource manager.
But if a file isn’t saved by Script Debugger, it won’t have this .rtf file or resource. Therefore the only way for the importer to extract the source would be to decompile the script. That, in turn, could lead to applications targeted in the scripts being launched. Obviously having applications mysteriously launch for no apparent reason – or worse, having dialogs appear asking where to find them – is less than ideal, so the only practical option for the importer is to ignore the content of such files.
The problem, really, is that compiled formats and Spotlight filters don’t work well together. And the Script Debugger importer can only deal with files that also include a separate version of the source, which means files saved by Script Debugger (and ASObjC Explorer). Oh, and, strangely enough, uncompiled autosaved .scpt files saved by Script Debugger (because they save a copy of the source in .rtf).
There’s a system-provided Spotlight importer for .rtf files, so I’m not sure why that’s happening.