mirror of
https://github.com/nim-lang/Nim.git
synced 2026-01-09 14:32:53 +00:00
[bugfix] nimpretty indents multiline comments correctly (#11607)
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user