Skip to content

Commit

Permalink
Fix indentation of xstring literal (#1038)
Browse files Browse the repository at this point in the history
Fixes indent calculation of this input
```
if false
p `ls`
end
```
  • Loading branch information
tompng authored Nov 26, 2024
1 parent 84366b8 commit 4217a46
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/irb/nesting_parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ def scan_opens(tokens)
when :on_heredoc_end
opens.pop
when :on_backtick
opens << [t, nil] if t.state.allbits?(Ripper::EXPR_BEG)
opens << [t, nil] unless t.state == Ripper::EXPR_ARG
when :on_tstring_beg, :on_words_beg, :on_qwords_beg, :on_symbols_beg, :on_qsymbols_beg, :on_regexp_beg
opens << [t, nil]
when :on_tstring_end, :on_regexp_end, :on_label_end
Expand Down
1 change: 1 addition & 0 deletions test/irb/test_nesting_parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ def `; end
def f() = 1
%(); %w[]; %q(); %r{}; %i[]
"#{1}"; ''; /#{1}/; `#{1}`
p(``); p ``; p x: ``; p 1, ``;
:sym; :"sym"; :+; :`; :if
[1, 2, 3]
{ x: 1, y: 2 }
Expand Down

0 comments on commit 4217a46

Please sign in to comment.