Alright then.

I have some stuff done.
Update you support folder and Experimental bundle.
Enjoy CodeCompletion goodness.

Only have a CodeCompletions list for Ruby sofar, and that probly needs to be recreated.
But the library is pretty hip.

If you want to start creating static completion lists, please do.


How to use this version
Create a tmCommand, input: selection or line, output: insert as snippet, contents like this:

#!/usr/bin/env ruby
require "#{ENV['TM_SUPPORT_PATH']}/lib/codecompletion"
TextmateCodeCompletion.simple


By default, it'll look for a tmPreference in that bundle with the name "CodeCompletions".
That preference should be like this:

{ completions = ( 'fibbity', 'flabbity', 'floo' ); }

Where the completions is an array of strings.
You can overwrite that by passing in a different name for the preference like this:

TextmateCodeCompletion.simple('SomeOtherNameForMyCompletions')

Or you can use any random plist file like this:

#!/usr/bin/env ruby
require "#{ENV['TM_SUPPORT_PATH']}/lib/codecompletion"
choices = TextmateCompletionsPlist.new('path_to_my_plist_file_of_doom').to_ary
print TextmateCodeCompletion.new(choices,STDIN.read).to_s


Or you can just pass in an array manually like so:

#!/usr/bin/env ruby
require "#{ENV['TM_SUPPORT_PATH']}/lib/codecompletion"
print TextmateCodeCompletion.new([ 'fibbity', 'flabbity', 'floo' ],STDIN.read).to_s


Some goals:

Allow for objects as input with snippets as output
Currently, the choices are simple an Array of strings.
We will need to extend this eventually to support objects with values that are snippets.
So you'll select your choice based on the key, but the calue of the key/value pair is inserted.

Speed improvements.
Maybe cache the plists in ram or something.

Line only input.
Currently we have to do some fancy footwork to insert the right thing in the right way
since the input can either be a selection or the current line.
And if you're input is a selection, then the command only replaces the selectio,
so you have to make sure you don't reinsert the context and the choice_partial and stuff like that.


thomas AylottÊÑÊdesign42ÊÑÊsubtleGradientÊÑÊCrazyEgg

On Dec 7, 2006, at 10:06 AM, thomas Aylott wrote:

Ok. There are now a bunch of people that have signed on to work on this thing.

Time to start divvying up the workload.

#1: First, we need a Ruby Class for the core essentials of the completion stuff. It needs to:
à Be an external library that can be called from a hundred different tmCommands
X Be fully runnable from the terminal by manually passing in all the arguments (so, use the TM_* vars only as fallback)
à Get the text you're in the middle of writing
à Get the list of completions based on that text from somewhere (see #2)
à Show the menu and let you make your selection
à Return a snippet with the results