instance method
ErrorHighlight::Spotter#spot_attrasgn_for_args
spot_attrasgn_for_args
lib/error_highlight/base.rb
View on GitHub ↗
# File tmp/rubies/ruby-4.0.0/lib/error_highlight/base.rb, line 434
def spot_attrasgn_for_args
nd_recv, mid, nd_args = @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_args.last_lineno
@end_column = nd_args.last_column
end
elsif nd_args && nd_args.first_lineno == nd_args.last_lineno
@beg_column = nd_args.first_column
@end_column = nd_args.last_column
end
# TODO: support @arg
end
Example:
x.foo = 1
^
x[42] = 1
^^^^^^^
x[] = 1
^^^^^
See also
#spot
#spot_attrasgn_for_name
#prism_spot_local_variable_operator_write_for_name
#spot_call_for_args
also in
4.1 · 3.4 · 3.3 · 3.2 · 3.1