-
Notifications
You must be signed in to change notification settings - Fork 3
/
Jump to Next Error.tmCommand
59 lines (49 loc) · 1.63 KB
/
Jump to Next Error.tmCommand
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<?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 -wKU
require ENV['TM_SUPPORT_PATH'] + '/lib/textmate'
project_file = ENV['XCODE_PROJECT_FILE'] || %x{ruby -- "${TM_BUNDLE_SUPPORT}/bin/find_xcode_project.rb"}.strip
LogFile = project_file + '/' + ENV['LOGNAME'] + '.tm_build_errors'
abort "No errors found" unless File.exists?(LogFile)
errors = []
File.readlines(LogFile).map do |error|
file, line, error = error.split('|')
if existing_error = errors.find { |e| e[:file] == file and e[:line] == line }
existing_error[:error] << error
else
errors << {:file => file, :line => line, :error => error}
end
end
abort "No errors found" if errors.empty?
current_error = nil
errors.each_with_index do |error, index|
if error[:file] == ENV['TM_FILEPATH'] and error[:line] == ENV['TM_LINE_NUMBER']
current_error = index
break
end
end
if current_error
current_error += 1
current_error = 0 if current_error > errors.size - 1
else
current_error = 0
end
TextMate.go_to :file => errors[current_error][:file], :line => errors[current_error][:line]
print errors[current_error][:error]</string>
<key>input</key>
<string>none</string>
<key>keyEquivalent</key>
<string>@=</string>
<key>name</key>
<string>Jump to Next Error</string>
<key>output</key>
<string>showAsTooltip</string>
<key>uuid</key>
<string>BA7499F1-F44C-43BC-9D81-AA1E889B35F7</string>
</dict>
</plist>