mirror of
https://github.com/atom/atom.git
synced 2026-04-28 03:01:47 -04:00
52 lines
1.4 KiB
Plaintext
52 lines
1.4 KiB
Plaintext
<?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 ruby
|
|
$: << "#{ENV['TM_SUPPORT_PATH']}/lib"
|
|
|
|
require "escape"
|
|
require "open3"
|
|
|
|
# make exceptions in the writing Thread kill the process so we don't hang
|
|
Thread.abort_on_exception = true
|
|
|
|
CURSOR = [0xFFFC].pack("U").freeze
|
|
line, col = ENV["TM_LINE_NUMBER"].to_i - 1, ENV["TM_LINE_INDEX"].to_i
|
|
|
|
stdin, stdout, stderr = Open3.popen3("/usr/bin/env", "ruby", "#{ENV['TM_BUNDLE_SUPPORT']}/bin/insert_requires.rb")
|
|
Thread.new do
|
|
code = STDIN.read.to_a
|
|
unless ENV.has_key?('TM_SELECTED_TEXT')
|
|
if code[line].nil? # if cursor was on the last line and it was blank
|
|
code << CURSOR
|
|
else
|
|
code[line][col...col] = CURSOR
|
|
end
|
|
end
|
|
stdin.write code.join
|
|
stdin.close
|
|
end
|
|
|
|
print stdout.read.split(CURSOR).join('${0}')
|
|
</string>
|
|
<key>fallbackInput</key>
|
|
<string>document</string>
|
|
<key>input</key>
|
|
<string>selection</string>
|
|
<key>keyEquivalent</key>
|
|
<string>^#</string>
|
|
<key>name</key>
|
|
<string>Insert Missing Requires</string>
|
|
<key>output</key>
|
|
<string>insertAsSnippet</string>
|
|
<key>scope</key>
|
|
<string>source.ruby</string>
|
|
<key>uuid</key>
|
|
<string>9FB64639-F776-499B-BA6F-BB45F86F80FD</string>
|
|
</dict>
|
|
</plist>
|