[bugfix] nimpretty indents multiline comments correctly (#11607)
This commit is contained in:
parent
cce8a739da
commit
c522a455df
3 changed files with 42 additions and 0 deletions
|
|
@ -145,6 +145,10 @@ proc closeEmitter*(em: var Emitter) =
|
||||||
maxLhs = 0
|
maxLhs = 0
|
||||||
lineBegin = i+1
|
lineBegin = i+1
|
||||||
of ltTab:
|
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:
|
if maxLhs == 0:
|
||||||
content.add em.tokens[i]
|
content.add em.tokens[i]
|
||||||
inc lineLen, em.tokens[i].len
|
inc lineLen, em.tokens[i].len
|
||||||
|
|
|
||||||
|
|
@ -657,3 +657,22 @@ type
|
||||||
key*, val*: TaintedString ## Key and value pair; the key is the option
|
key*, val*: TaintedString ## Key and value pair; the key is the option
|
||||||
## or the argument, and the value is not "" if
|
## or the argument, and the value is not "" if
|
||||||
## the option was given a value
|
## 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
|
||||||
|
|
|
||||||
|
|
@ -663,3 +663,22 @@ type
|
||||||
key*, val*: TaintedString ## Key and value pair; the key is the option
|
key*, val*: TaintedString ## Key and value pair; the key is the option
|
||||||
## or the argument, and the value is not "" if
|
## or the argument, and the value is not "" if
|
||||||
## the option was given a value
|
## 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
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue