Find file
Fetching contributors…
Cannot retrieve contributors at this time
62 lines (57 sloc) 1.66 KB
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>beforeRunningCommand</key>
<string>nop</string>
<key>bundleUUID</key>
<string>4679484F-6227-11D9-BFB1-000D93589AF6</string>
<key>command</key>
<string>#!/usr/bin/env ruby18
require "#{ENV['TM_SUPPORT_PATH']}/lib/exit_codes"
require "#{ENV['TM_SUPPORT_PATH']}/lib/escape"
require "#{ENV['TM_BUNDLE_SUPPORT']}/objc_completion2"
def stripComments(line)
line.gsub(/((['"])(?:\\.|.)*?\2)|\/\*.*?\*\/|\/\/[^\n\r]*/m) do |s|
if $1
s
else
' ' * s.length()
end
end
end
class String
def index_of_nth_occurrence_of(n, ch)
self.unpack("U*").each_with_index do |e, i|
return i if e == ch &amp;&amp; (n -= 1) == 0
end
return -1
end
end
def caret_position(line)
tmp = ENV['TM_LINE_NUMBER'].to_i - ENV['TM_INPUT_START_LINE'].to_i
if tmp &gt; 0
caret_placement = line.index_of_nth_occurrence_of(tmp,?\n) + ENV['TM_LINE_INDEX'].to_i
else
caret_placement =ENV['TM_LINE_INDEX'].to_i-ENV['TM_INPUT_START_LINE_INDEX'].to_i - 1
end
end
line = ENV['TM_CURRENT_LINE']
caret_placement = caret_position(line)
res = ObjCFallbackCompletion.new(stripComments(line) , caret_placement).print
os = 0
print res</string>
<key>input</key>
<string>none</string>
<key>keyEquivalent</key>
<string>~</string>
<key>name</key>
<string>Completion: Fallback</string>
<key>output</key>
<string>insertAsSnippet</string>
<key>scope</key>
<string>source.objc, source.objc++</string>
<key>uuid</key>
<string>88754B0F-D8DB-4796-9D02-058B756C606D</string>
</dict>
</plist>