@@ -1214,7 +1214,7 @@ def format(q)
12141214
12151215 q . group do
12161216 case lbracket
1217- when QSymbolsBeg , QWordsBeg , WordsBeg
1217+ when QSymbolsBeg , QWordsBeg , WordsBeg , SymbolsBeg
12181218 q . text ( lbracket . value )
12191219 else
12201220 q . format ( lbracket )
@@ -1228,7 +1228,7 @@ def format(q)
12281228 q . seplist ( contents . parts , BREAKABLE_SPACE_SEPARATOR ) do |part |
12291229 q . text ( part . value )
12301230 end
1231- when WordsBeg
1231+ when WordsBeg , SymbolsBeg
12321232 q . seplist ( contents . parts , BREAKABLE_SPACE_SEPARATOR ) do |part |
12331233 q . format ( part )
12341234 end
@@ -1242,7 +1242,7 @@ def format(q)
12421242 q . breakable_empty
12431243
12441244 case lbracket
1245- when QSymbolsBeg , QWordsBeg , WordsBeg
1245+ when QSymbolsBeg , QWordsBeg , WordsBeg , SymbolsBeg
12461246 q . text ( lbracket . value [ -1 ] == "{" ? "}" : "]" )
12471247 else
12481248 q . text ( "]" )
@@ -1420,7 +1420,7 @@ def ===(other)
14201420 module AssignFormatting
14211421 def self . skip_indent? ( value )
14221422 case value
1423- when ArrayLiteral , HashLiteral , Heredoc , Lambda , Symbols
1423+ when ArrayLiteral , HashLiteral , Heredoc , Lambda
14241424 true
14251425 when CallNode
14261426 skip_indent? ( value . receiver )
@@ -10444,82 +10444,6 @@ def ===(other)
1044410444 end
1044510445 end
1044610446
10447- # Symbols represents a symbol array literal with interpolation.
10448- #
10449- # %I[one two three]
10450- #
10451- class Symbols < Node
10452- # [SymbolsBeg] the token that opens this array literal
10453- attr_reader :beginning
10454-
10455- # [Array[ Word ]] the words in the symbol array literal
10456- attr_reader :elements
10457-
10458- # [Array[ Comment | EmbDoc ]] the comments attached to this node
10459- attr_reader :comments
10460-
10461- def initialize ( beginning :, elements :, location :)
10462- @beginning = beginning
10463- @elements = elements
10464- @location = location
10465- @comments = [ ]
10466- end
10467-
10468- def accept ( visitor )
10469- visitor . visit_symbols ( self )
10470- end
10471-
10472- def child_nodes
10473- [ ]
10474- end
10475-
10476- def copy ( beginning : nil , elements : nil , location : nil )
10477- Symbols . new (
10478- beginning : beginning || self . beginning ,
10479- elements : elements || self . elements ,
10480- location : location || self . location
10481- )
10482- end
10483-
10484- alias deconstruct child_nodes
10485-
10486- def deconstruct_keys ( _keys )
10487- {
10488- beginning : beginning ,
10489- elements : elements ,
10490- location : location ,
10491- comments : comments
10492- }
10493- end
10494-
10495- def format ( q )
10496- opening , closing = "%I[" , "]"
10497-
10498- if elements . any? { |element | element . match? ( /[\[ \] ]/ ) }
10499- opening = beginning . value
10500- closing = Quotes . matching ( opening [ 2 ] )
10501- end
10502-
10503- q . text ( opening )
10504- q . group do
10505- q . indent do
10506- q . breakable_empty
10507- q . seplist (
10508- elements ,
10509- ArrayLiteral ::BREAKABLE_SPACE_SEPARATOR
10510- ) { |element | q . format ( element ) }
10511- end
10512- q . breakable_empty
10513- end
10514- q . text ( closing )
10515- end
10516-
10517- def ===( other )
10518- other . is_a? ( Symbols ) && beginning === other . beginning &&
10519- ArrayMatch . call ( elements , other . elements )
10520- end
10521- end
10522-
1052310447 # SymbolsBeg represents the start of a symbol array literal with
1052410448 # interpolation.
1052510449 #
0 commit comments