module RBS::DetailedMessageable

Public Instance Methods

detailed_message(highlight: false, **) click to toggle source
Calls superclass method
# File rbs-3.1.0/lib/rbs/errors.rb, line 24
def detailed_message(highlight: false, **)
  msg = super

  # Support only one line
  return msg unless location.start_line == location.end_line

  indent = " " * location.start_column
  marker = "^" * (location.end_column - location.start_column)

  io = StringIO.new
  io.puts msg
  io.puts
  io.print "\e[1m" if highlight
  io.puts "  #{location.buffer.lines[location.end_line - 1]}"
  io.puts "  #{indent}#{marker}"
  io.print "\e[m" if highlight
  io.string
end