Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions lib/irb/color.rb
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,11 @@ def visit_alias_method_node(node)
super
end

def visit_implicit_node(_node)
# Label of implicit nodes are colored as LABEL in visit_symbol_node.
# We need to prevent value part from being colored with another type.
end

def visit_call_node(node)
if node.call_operator_loc.nil? && OPERATORS.include?(node.name)
# Operators should not be colored as method call
Expand Down
1 change: 1 addition & 0 deletions test/irb/test_color.rb
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ def test_colorize_code
'ENV' => "#{BLUE}#{BOLD}#{UNDERLINE}ENV#{CLEAR}",
'f do end' => "#{CYAN}f#{CLEAR} #{GREEN}do#{CLEAR} #{GREEN}end#{CLEAR}",
'f true do end' => "#{CYAN}f#{CLEAR} #{CYAN}#{BOLD}true#{CLEAR} #{GREEN}do#{CLEAR} #{GREEN}end#{CLEAR}",
'{"foo": 1, bar:, BAZ:}' => "{#{MAGENTA}\"foo\":#{CLEAR} #{BLUE}#{BOLD}1#{CLEAR}, #{MAGENTA}bar:#{CLEAR}, #{MAGENTA}BAZ:#{CLEAR}}",
}

tests.each do |code, result|
Expand Down
Loading