Permalink
Browse files

Update stack trace hyperlinking

We no longer test for untitled documents since these are transparently handled by TextMate.executor.
  • Loading branch information...
1 parent 6f4f314 commit 2170d5491f6371d9e3215761dc9236688a0b478e @sorbits sorbits committed Jan 10, 2013
Showing with 6 additions and 6 deletions.
  1. +6 −6 Support/RubyMate/catch_exception.rb
@@ -16,17 +16,17 @@
io.write "<blockquote><table border='0' cellspacing='4' cellpadding='0'>\n"
+ 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
+ url, display_name = '', file
- url, display_name = '', 'untitled document';
- if file != '-' && File.exists?(file) && !ENV['TM_FILE_IS_UNTITLED'] then
- file = Pathname.new(file).realpath.to_s
- url = '&url=file://' + e_url(file)
- display_name = File.basename(file)
+ path = dirs.map{ |dir| File.expand_path(file, dir) }.find{ |path| File.file? path }
+ 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 << (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"

0 comments on commit 2170d54

Please sign in to comment.