Maintenance Ruby 3.3 gets fixes, but no new features. Switch to Ruby 4.0 →
instance method
ErrorHighlight::Spotter#spot_op_asgn1_for_args
spot_op_asgn1_for_args
lib/error_highlight/base.rb
View on GitHub ↗
# File tmp/rubies/ruby-3.3.0/lib/error_highlight/base.rb, line 439
def spot_op_asgn1_for_args
nd_recv, mid, nd_args, nd_rhs = @node.children
fetch_line(nd_recv.last_lineno)
if mid == :[]= && @snippet.match(/\G\s*\[/, nd_recv.last_column)
@beg_column = $~.end(0)
if nd_recv.last_lineno == nd_rhs.last_lineno
@end_column = nd_rhs.last_column
end
elsif nd_args && nd_args.first_lineno == nd_rhs.last_lineno
@beg_column = nd_args.first_column
@end_column = nd_rhs.last_column
end
# TODO: support @arg
end
Example:
x[1] += 42 ^^^^^^^^
See also
#spot_fcall_for_name
#spot_op_asgn1_for_name
#spot_fcall_for_args
#spot_op_asgn2_for_args
also in
4.1 · 4.0 · 3.4 · 3.2 · 3.1