Open a file at the specified line number (Textmate error handling...)
Submitted by Sunday, 12 February, 2006 - 00:22
on
Hi folks,
There is a rails plugin [1] that convert errors to a url that can be opened by textmate.
Here is the main point:
html = "#{line}"
Is there a way for us to do something like this?
Thanks in advance,
- H
[1] code extracted from the plugin
def add_links_to_backtrace(lines)
lines.collect do |line|
expanded = line.gsub '#{RAILS_ROOT}', RAILS_ROOT
if match = expanded.match(/^(.+):(\d+):in/) or match = expanded.match(/^(.+):(\d+)\s*$/)
file = File.expand_path(match[1])
line_number = match[2]
html = "#{line}"
else
line
end
end
end
There is a rails plugin [1] that convert errors to a url that can be opened by textmate.
Here is the main point:
html = "#{line}"
Is there a way for us to do something like this?
Thanks in advance,
- H
[1] code extracted from the plugin
def add_links_to_backtrace(lines)
lines.collect do |line|
expanded = line.gsub '#{RAILS_ROOT}', RAILS_ROOT
if match = expanded.match(/^(.+):(\d+):in/) or match = expanded.match(/^(.+):(\d+)\s*$/)
file = File.expand_path(match[1])
line_number = match[2]
html = "#{line}"
else
line
end
end
end