[TxMt] Re: Performance Request: Faster "Find in Project"

Allan Odgaard throw-away-1 at macromates.com
Tue May 29 13:31:06 UTC 2007

On 28. May 2007, at 19:50, David Eriksson wrote:

> [...]
> Tried BBEdit, Xcode and searched the same project and they didn't  
> look in that specific file. I know that deciding if the file is  
> text or binary would be tricky, I mean we could have a 100MB+  
> postscript file, but would be interesting to know what differs betw  
> say TM and xCode here.

The way TM presently does it is by:

  1) check if TM is set as the handler for this file type (in  
Finder), if so, search it
  2) check if the extension is known as a binary or text extension --  
all extensions declared in TM’s Info.plist are known text extensions,  
but you can right-click a file in the project drawer to toggle the  
type for the clicked file’s extension
  3) scan the first 8 KB of the file and check if it is a) valid  
UTF-8 and b) contains no control characters (i.e. below 0x20) except  
for tab and carriage return / line feed).

Files w/o extension will thus always pass/fall based on the third check.

When 2.0 is out, it should be easier to see which files TM chokes on  
based on the new UI, at that time I’ll take input on improving the  
heuristic, if there are still problems.

More information about the textmate mailing list