From b1652af4b97077eb2d4c8cff7f9fc442a76aa002 Mon Sep 17 00:00:00 2001 From: windwiny Date: Mon, 30 Oct 2017 16:53:18 +0800 Subject: [PATCH 1/2] add column show tail message --- Support/RubyMate/catch_exception.rb | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Support/RubyMate/catch_exception.rb b/Support/RubyMate/catch_exception.rb index e3eada2..5a7d1cd 100644 --- a/Support/RubyMate/catch_exception.rb +++ b/Support/RubyMate/catch_exception.rb @@ -18,8 +18,8 @@ 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*`(.*?)'(.*))?/ then + file, line, method, tail = $1, $2, $3, $4.to_s.strip url, display_name = '', file path = dirs.map{ |dir| File.expand_path(file, dir) }.find{ |filename| File.file? filename } @@ -27,9 +27,10 @@ url, display_name = '&url=file://' + e_url(path), File.basename(path) end - io << "" + io << "" io << (method ? "method #{CGI::escapeHTML method}" : 'at top level') - io << "\nin #{CGI::escapeHTML display_name} at line #{line}\n" + io << "\nin #{CGI::escapeHTML display_name} at line #{line}" + io << "#{tail}\n" end end From 9f3d73e30dcb05a24f0b91b458d9e3ddf76b2638 Mon Sep 17 00:00:00 2001 From: windwiny Date: Mon, 30 Oct 2017 17:35:14 +0800 Subject: [PATCH 2/2] replace space, newline chars --- Support/RubyMate/catch_exception.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Support/RubyMate/catch_exception.rb b/Support/RubyMate/catch_exception.rb index 5a7d1cd..8022340 100644 --- a/Support/RubyMate/catch_exception.rb +++ b/Support/RubyMate/catch_exception.rb @@ -18,8 +18,9 @@ dirs = [ '.', ENV['TM_PROJECT_DIRECTORY'], ENV['TM_DIRECTORY'] ] e.backtrace.each do |b| - if b =~ /(.*?):(\d+)(?::in\s*`(.*?)'(.*))?/ then + if b =~ /(.*?):(\d+)(?::in\s*`(.*?)'(.*))?/m then file, line, method, tail = $1, $2, $3, $4.to_s.strip + tail = tail.gsub("\n","
").gsub(" ", " ") if tail.include?("\n") url, display_name = '', file path = dirs.map{ |dir| File.expand_path(file, dir) }.find{ |filename| File.file? filename }