Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions Support/RubyMate/catch_exception.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,20 @@

dirs = [ '.', ENV['TM_PROJECT_DIRECTORY'], ENV['TM_DIRECTORY'] ]
e.backtrace.each do |b|
if b =~ /(.*?):(\d+)(?::in\s*`(.*?)')?/ then
file, line, method = $1, $2, $3
if b =~ /(.*?):(\d+)(?::in\s*`(.*?)'(.*))?/m then
file, line, method, tail = $1, $2, $3, $4.to_s.strip
tail = tail.gsub("\n","<br>").gsub(" ", "&nbsp;") if tail.include?("\n")
url, display_name = '', file

path = dirs.map{ |dir| File.expand_path(file, dir) }.find{ |filename| File.file? filename }
unless path.nil?
url, display_name = '&amp;url=file://' + e_url(path), File.basename(path)
end

io << "<tr><td><a class='near' href='txmt://open?line=#{line + url}'>"
io << "<tr><td width=\"120\"><a class='near' href='txmt://open?line=#{line + url}'>"
io << (method ? "method #{CGI::escapeHTML method}" : '<em>at top level</em>')
io << "</a></td>\n<td>in <strong>#{CGI::escapeHTML display_name}</strong> at line #{line}</td></tr>\n"
io << "</a></td>\n<td width=\"160\">in <strong>#{CGI::escapeHTML display_name}</strong> at line #{line}</td>"
io << "<td>#{tail}</td></tr>\n"
end
end

Expand Down