Skip to content

Wrong indent when alias undef is used with keywords #767

Closed

Description

@tompng

Description

Indentation of alias undef with keywords def do if end (keywords that increase/decrease indent) is wrong.

irb(main):001* if true
irb(main):002*   alias if def
irb(main):003*       undef do
irb(main):004*         1
irb(main):005*     alias end end
irb(main):006*   undef end
irb(main):007> end

It can be combined with heredoc and can be nested, making the fix harder.

def do
  <<~A; alias
  A
  do
    # can write comment here
    :"#{alias do do; 'do'}"
    end
# => :do

Result of irb_info

Ruby version: 3.2.2
IRB version: irb 1.9.0 (2023-11-11)
InputMethod: RelineInputMethod with Reline 0.4.0
Completion: Autocomplete, RegexpCompletor
RUBY_PLATFORM: arm64-darwin22
LANG env: ja_JP.UTF-8
East Asian Ambiguous Width: 1

Terminal Emulator

Terminal.app

Setting Files

Are you using ~/.irbrc and ~/.inputrc?
No

Activity

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