[bugfix] nimpretty indents multiline comments correctly (#11607)

This commit is contained in:
Miran
2019-07-02 10:52:46 +02:00
committed by Andreas Rumpf
parent cce8a739da
commit c522a455df
3 changed files with 42 additions and 0 deletions

View File

@@ -145,6 +145,10 @@ proc closeEmitter*(em: var Emitter) =
maxLhs = 0
lineBegin = i+1
of ltTab:
if i >= 2 and em.kinds[i-2] == ltNewline and em.kinds[i-1] in {ltNewline, ltSpaces}:
# a previous section has ended
maxLhs = 0
if maxLhs == 0:
content.add em.tokens[i]
inc lineLen, em.tokens[i].len

View File

@@ -657,3 +657,22 @@ type
key*, val*: TaintedString ## Key and value pair; the key is the option
## or the argument, and the value is not "" if
## the option was given a value
block:
var t = 3
## This MUST be a multiline comment,
## single line comment would be ok.
block:
var x = 7
block:
var t = 3
## another
## multi
## This MUST be a multiline comment,
## single line comment would be ok.
block:
var x = 7

View File

@@ -663,3 +663,22 @@ type
key*, val*: TaintedString ## Key and value pair; the key is the option
## or the argument, and the value is not "" if
## the option was given a value
block:
var t = 3
## This MUST be a multiline comment,
## single line comment would be ok.
block:
var x = 7
block:
var t = 3
## another
## multi
## This MUST be a multiline comment,
## single line comment would be ok.
block:
var x = 7