Skip to content

Don't fix indent level inside a heredoc #60

Closed

Description

@aycabta
puts <<EOS
a
  EOS
EOS
p <<-E
  a
E

These examples are broken by autoindent.

Activity

  1. BenKanouse commented on Jan 5, 2020

    @BenKanouse
    Contributor

    I noticed a similar issue while working on #55

    Here is my example:

    2.7.0 :001 > def foo
    2.7.0 :002">   <<BAR
    2.7.0 :003">   string
    2.7.0 :004">   BAR
    2.7.0 :005">   end
    2.7.0 :006">   end
    2.7.0 :007">   end
    2.7.0 :008">   ^C
    2.7.0 :001 >
    2.7.0 :002 > def foo
    2.7.0 :003">   <<-BAR
    2.7.0 :004">   string
    2.7.0 :005 >   BAR
    2.7.0 :006 >   end
     => :foo
    2.7.0 :007 >
    2.7.0 :008 > foo
     => "  string\n"
    2.7.0 :009 >
    

    The heredoc with <<BAR wouldn't let me end the method and I needed to ctrl-C to get out of the method definition while the <<-BAR would let me end the method (but possibly with the wrong indentation).

    So we might this issue might be deeper than just the level of indenting?

  2. tompng commented on Jun 20, 2023

    @tompng
    Member

    I think it's fixed by #515

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions