ruby-changes:72908
From: Yusuke <ko1@a...>
Date: Fri, 12 Aug 2022 14:04:58 +0900 (JST)
Subject: [ruby-changes:72908] d9f1b8baa3 (master): [ruby/error_highlight] Add a note about the current limitation of ErrorHighlight.spot
https://git.ruby-lang.org/ruby.git/commit/?id=d9f1b8baa3 From d9f1b8baa3a21b2a65af7fcab6a45c30b3f9efee Mon Sep 17 00:00:00 2001 From: Yusuke Endoh <mame@r...> Date: Fri, 12 Aug 2022 14:04:04 +0900 Subject: [ruby/error_highlight] Add a note about the current limitation of ErrorHighlight.spot https://github.com/ruby/error_highlight/commit/489ce80a62 --- lib/error_highlight/base.rb | 8 ++++++++ 1 file changed, 8 insertions(+) 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 https://github.com/ruby/ruby/blob/trunk/lib/error_highlight/base.rb#L22 # 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 -- cgit v1.2.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/