summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYusuke Endoh <mame@ruby-lang.org>2022-08-12 14:04:04 +0900
committergit <svn-admin@ruby-lang.org>2022-08-12 14:04:41 +0900
commitd9f1b8baa3a21b2a65af7fcab6a45c30b3f9efee (patch)
treecfaecdaf0145a6443ba0c9d9ebcc53d86b2140e7
parent5e3e4bc9840160f2a6f85cba2e05279d7668b014 (diff)
[ruby/error_highlight] Add a note about the current limitation of ErrorHighlight.spot
https://github.com/ruby/error_highlight/commit/489ce80a62
-rw-r--r--lib/error_highlight/base.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/error_highlight/base.rb b/lib/error_highlight/base.rb
index dbd173a5cd..4c115cc828 100644
--- a/lib/error_highlight/base.rb
+++ b/lib/error_highlight/base.rb
@@ -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