irb icon indicating copy to clipboard operation
irb copied to clipboard

Make `literal_type` indicator detect more open chunks of code, not only strings

Open SteveRedka opened this issue 5 years ago • 0 comments

Description

Literal type (or @ltype) is this character in the end of prompt:

          ↓
2.6.3 :001 > 'closed string'
2.6.3 :002"> %Q[not closed array of words
2.6.3 :003/> /not closed regexp
2.6.3 :004`> `echo open backtick
          ↑

Documentation says that it detects string types:

#     %l    # type of string(", ', /, ]), `]' is inner %w[...]

But it already does more than that, detecting regular expressions and some array types:

2.6.3 :003/> /not closed regexp
# Array of words
2.6.3 :003]> %w[word word

So I think it would be convenient if it detected open parentheses, square and curly braces as well. For example:

2.6.3 :003)> parentheses = (a + b * c
2.6.3 :003]> array = [1, 'milk'

SteveRedka avatar Apr 07 '20 23:04 SteveRedka