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] proc is transfered to incorrect code #8626

Closed
ghost opened this issue Aug 13, 2018 · 1 comment
Closed

[nimpretty] proc is transfered to incorrect code #8626

ghost opened this issue Aug 13, 2018 · 1 comment
Labels

Comments

@ghost
Copy link

ghost commented Aug 13, 2018

The correct code

proc getKeyAndData(cursor: int, op: int):
    tuple[key, data: string, success: bool] {.noInit.} =
  var keyVal: string
  var dataVal: string

is transfered to the incorrect

proc getKeyAndData(cursor: int, op: int):
    tuple[key, data: string, success: bool] {.noInit.} =
var keyVal: string
    var dataVal: string

The same happens for:

proc test(): string
    {.noSideEffect, raises: [].} =
  ## test
  discard

which results in:

proc test(): string
    {.noSideEffect, raises: [].} =
## test
    discard
@ghost
Copy link
Author

ghost commented Oct 19, 2018

The fix will put everything on the same level like the indented line is.
I think it is better to let the code below the indented line on the same level like it was before.
At least this was the coding style I wanted in the case of a proc that line breaked.

For example:

proc getKeyAndData(cursor: int, op: int):
    tuple[key, data: string, success: bool] {.noInit.} =
  var keyVal: string
  var dataVal: string

Should stay when formatted.
Now it becomes

proc getKeyAndData(cursor: int, op: int):
    tuple[key, data: string, success: bool] {.noInit.} =
    var keyVal: string
    var dataVal: string

narimiran pushed a commit to narimiran/Nim that referenced this issue Oct 31, 2018
narimiran pushed a commit to narimiran/Nim that referenced this issue Nov 1, 2018
narimiran pushed a commit that referenced this issue Nov 1, 2018
narimiran pushed a commit that referenced this issue Nov 1, 2018
(cherry picked from commit ed38079)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant