[ruby/error_highlight] Add a note about the current limitation of ErrorHighlight.spot

https://github.com/ruby/error_highlight/commit/489ce80a62
This commit is contained in:
Yusuke Endoh 2022-08-12 14:04:04 +09:00 committed by git
parent 5e3e4bc984
commit d9f1b8baa3

View File

@ -22,6 +22,14 @@ module ErrorHighlight
# snippet: String,
# script_lines: [String],
# } | nil
#
# Limitations:
#
# Currently, ErrorHighlight.spot only supports a single-line code fragment.
# Therefore, if the return value is not nil, first_lineno and last_lineno will have
# the same value. If the relevant code fragment spans multiple lines
# (e.g., Array#[] of +ary[(newline)expr(newline)]+), the method will return nil.
# This restriction may be removed in the future.
def self.spot(obj, **opts)
case obj
when Exception