[bugfix] fix #11469, new rules for a newline in nimpretty (#11512)

* [bugfix] fix #11469, new rules for a newline in nimpretty
* concatenate two lines if they have the same indentation level
This commit is contained in:
Miran 2019-06-26 15:36:44 +02:00 • committed by Andreas Rumpf
commit f288e1b11a
7 changed files with 112 additions and 72 deletions

View file

@ -122,7 +122,7 @@ type
fixedUntil: int # marks where we must not go in the content
altSplitPos: array[SplitKind, int] # alternative split positions
proc openEmitter*[T, S](em: var Emitter; config: ConfigRef, fileIdx: FileIndex) {.pragmaHereWrongCurlyEnd} =
proc openEmitter*[T, S](em: var Emitter; config: ConfigRef; fileIdx: FileIndex) {.pragmaHereWrongCurlyEnd} =
let outfile = changeFileExt(config.toFullPath(fileIdx), ".pretty.nim")
em.f = llStreamOpen(outfile, fmWrite)
em.config = config
@ -607,3 +607,14 @@ type
tagVar, ## the HTML ``var`` element
tagVideo, ## the HTML ``video`` element
tagWbr ## the HTML ``wbr`` element
# bug #11469
const lookup: array[32, uint8] = [0'u8, 1, 28, 2, 29, 14, 24, 3, 30, 22, 20, 15, 16, 17,
25, 17, 4, 8, 31, 27, 13, 23]
veryLongVariableName.createVar("future" & $node[1][0].toStrLit, node[1], futureValue1,
futureValue2, node)
veryLongVariableName.createVar("future" & $node[1][0].toStrLit, node[1], futureValue1,
futureValue2, node)