Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
66 lines (57 sloc) 2.17 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>command</key>
<string>#!/usr/bin/env ruby18
# Inserts a [super method] call suitable for the current method.
#
# The command is inserted as a snippet with each parameter as a tabstop
# An opening bracket is inserted if necessary, and a semicolon is
# added after the closing bracket if there is nothing else on the line.
#
# The command uses heuristics to find which method implementation is
# being edited. It should be reasonably tolerant to various coding styles,
# including different bracket and indentation styles.
proto_re = /
^\s* # Start of the line and optional space
[+-]\s* # a plus or minus for method specifier
\([^)]+\) # the return type in brackets
(?!.*;) # Assert implementation and not interface
((?:\n|[^{])*)
(?m:.*?)
\{
/x
previous_lines = STDIN.readlines[1..ENV['TM_LINE_NUMBER'].to_i - 1]
invocation_line = previous_lines[-1]
proto = previous_lines.join.scan(proto_re)[-1]
exit if proto.nil? or proto.empty?
last_proto_sel_with_types = proto[0].strip.sub(/^\s+/, '').sub(%r{\s*//.*$}, '').gsub(/\n\s*/, ' ')
tabstop = 0
last_proto_sel_with_types.gsub!(/\([^)]+\)\s*(([A-Za-z0-9_][A-Za-z0-9_]*))/) do |match|
%Q{${#{tabstop += 1}:#$1}}
end
print '[' if invocation_line[ENV["TM_LINE_INDEX"].to_i - 1] != ?[
print 'super '
print last_proto_sel_with_types
print "]"
print ";" if invocation_line =~ /^\s+$/
</string>
<key>fallbackInput</key>
<string>scope</string>
<key>input</key>
<string>document</string>
<key>name</key>
<string>Insert Call to Super</string>
<key>output</key>
<string>insertAsSnippet</string>
<key>scope</key>
<string>source.objc meta.scope.implementation, source.objc++ meta.scope.implementation</string>
<key>tabTrigger</key>
<string>super</string>
<key>uuid</key>
<string>DA9B35AF-938D-4166-8576-E8E3C73F0739</string>
</dict>
</plist>
Something went wrong with that request. Please try again.