[TxMt] Re: Cocoa Autocomplete

Adam R. Maxwell amaxwell at mac.com
Thu Jan 11 15:31:47 UTC 2007


On Jan 11, 2007, at 07:12, Sam Halliday wrote:

> On 11 Jan 2007, at 15:02, Adam R. Maxwell wrote:
>> I think you could write a Foundation command-line tool that calls  
>> [[NSSpellChecker sharedSpellChecker]  
>> completionsForPartialWordRange:inString:language:inSpellDocumentWithTag 
>> :] and provides its results via tm_dialog.  I did a similar thing  
>> in writing a tool that asks BibDesk for citation completions, and  
>> it works pretty well.
>
> That sounds like the best way to hack it! It would also be a way of  
> getting at the preferred spelling correction for misspelt words.  
> Foundation is the Objective C framework, right? Do you have any  
> examples of programs doing something similar?

Yeah, this gives access to what TextEdit et al. use for completion in  
NSTextView.  Create a new Foundation tool in Xcode and fill in the  
blanks :).  The source for my program is at http://homepage.mac.com/amaxwell 
  as BibDeskTMCompletions.zip; just look at the part where it returns  
data via stdout.  I think the .tmcommand is in the Completion.zip file  
at the same address.  If not, e-mail me off-list.

-- Adam




More information about the textmate mailing list