Guessing I'm the 32342 person to ask this but google wouldn't help me out. Any of you clever people out there know a way to define a file on a per project basis to augment the autocomplete for the current scope and doc? Main use cases for me are pointing to a library file to autocomplete method names and pointing to a CSS file to be able to autocomplete ID and class names.
Thanks for any help.
Will
On Feb 5, 2010, at 7:20 AM, Will wrote:
[ ... ] know a way to define a file on a per project basis to augment the autocomplete for the current scope and doc? Main use cases for me are pointing to a library file to autocomplete method names and pointing to a CSS file to be able to autocomplete ID and class names.
Hi,
one can achieve that be defining different Preferences in the Bundle Editor for a given scope(s). Simply create a new preference file in the Bundle Editor, set the Scope Selector, and as command:
{ completionCommand = ' …YOUR_SCRIPT… '}
As an example you can e.g. look into C's bundle "Header Completion (System)", "Header Completion (User)".
In YOUR_SCRIPT one can query TM_PROJECT_*, accumulate the completion suggestions, and pipe them back to TM as one suggestion per line.
An other approach can be to use "$DIALOG" via the internal Ruby bridge command TextMate::UI.complete to come up with a narrow-down completion list. See e.g. bundle command "Objective-C" > "Completion: Inside @selector" and the script itself in …/Bundles/Objective-C.tmbundle/bin/objc_selector_completions2.rb
Cheers,
--Hans