Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nimpretty breaks indentation of if expression #12651

Open
observant2 opened this issue Nov 13, 2019 · 0 comments
Open

Nimpretty breaks indentation of if expression #12651

observant2 opened this issue Nov 13, 2019 · 0 comments

Comments

@observant2
Copy link

Example

nimpretty input:

proc draw(obj: Image, pos: Position) =
  var rect = sdl.Rect(x: pos.x, y: pos.y, w: obj.width, h: obj.height)
  if not obj.renderer
            .renderCopyEx(obj.texture,
                          nil, addr(rect),
                          angle = pos.rotation,
                          center = nil,
                          FLIP_NONE) == 0:
    sdl.logWarn(LOG_CATEGORY_VIDEO,
                "Can't render image1: %s",
                sdl.getError())

Current Output

proc draw(obj: Image, pos: Position) =
  var rect = sdl.Rect(x: pos.x, y: pos.y, w: obj.width, h: obj.height)
  if not obj.renderer
    .renderCopyEx(obj.texture,
                  nil, addr(rect),
                  angle = pos.rotation,
                  center = nil,
                  FLIP_NONE) == 0:
  sdl.logWarn(LOG_CATEGORY_VIDEO, # <- This statement escaped the if block!
                "Can't render image1: %s",
                sdl.getError())

Expected Output

I don't know what I expected, but at least nimpretty shouldn't break it. 👽

$ nim -v
Nim Compiler Version 1.0.2 [Windows: i386]
Compiled at 2019-10-22
Copyright (c) 2006-2019 by Andreas Rumpf

git hash: 193b3c66bbeffafaebff166d24b9866f1eaaac0e
active boot switches: -d:release
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants