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; }
Make sure you call the preference as it is named on disk. Renaming a preference in the bundle editor doesn't actually change anything on disk.
thomas Aylott — subtleGradient — CrazyEgg — sixteenColors
On Apr 2, 2007, at 3:42 PM, Oliver Taylor wrote:
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: