[TxMt] Code Completion Issues

Oliver Taylor oliver at ollieman.net
Mon Apr 2 19:43:27 UTC 2007


I've got a code completion command set-up to scan a preference item  
and the document and return a list (as usual) but I suddenly realized  
it's not returning any results from the preference item. I can't  
figure it out. Code pasted below:

-----------------------------------------
COMMAND
input:selected text or line
output:insert as snippet
-----------------------------------------

#!/usr/bin/env ruby
require "#{ENV['TM_SUPPORT_PATH']}/lib/codecompletion"
preference = 'Time of Day'

choices = []

TextmateCompletionsParser::PARSERS[:screenplay_time] = {
   :select => /^[^a-z\n\t]+\s-\s([^a-z\n].*)\s*$/,
   :sort => true
}

parsed_choices = TextmateCompletionsParser.new(nil, :scope  
=> :screenplay_time).to_ary
choices += parsed_choices if parsed_choices

choices.each { |c| c.downcase! }

choices += ['--']

plist_choices = TextmateCompletionsPlist.new( "#{ENV 
['TM_BUNDLE_PATH']}/Preferences/#{preference}.tmPreferences" ).to_ary
choices += plist_choices if plist_choices

print TextmateCodeCompletion.new(choices,'', :scope  
=> :screenplay_time).to_snippet.upcase


-----------------------------------------
PREFERENCE ITEM
-----------------------------------------

{	completions = ( 'day', 'dusk', 'dawn', 'night', 'noon', 'sunrise',  
'sunset', 'twilight', 'magic hour', 'afternoon', 'morning',  
'evening', 'later', 'moments later', 'continuous', 'the next day',  
'intercut' );
	disableDefaultCompletion = 1;
}



More information about the textmate mailing list