Maintenance Ruby 3.4 gets fixes, but no new features. Switch to Ruby 4.0 →
class method
ErrorHighlight.prism_find
prism_find(location)
lib/error_highlight/base.rb
View on GitHub ↗
# File tmp/rubies/ruby-3.4.1/lib/error_highlight/base.rb, line 86
def self.prism_find(location)
require "prism"
return nil if Prism::VERSION < "1.0.0"
absolute_path = location.absolute_path
return unless absolute_path
node_id = RubyVM::AbstractSyntaxTree.node_id_for_backtrace_location(location)
Prism.parse_file(absolute_path).value.breadth_first_search { |node| node.node_id == node_id }
end
Accepts a Thread::Backtrace::Location object and returns a Prism::Node corresponding to the backtrace location in the source code.