nextlua 3.2.0 → 3.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/main.js +12 -2
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "nextlua",
3
3
  "displayName": "nextlua",
4
- "version": "3.2.0",
4
+ "version": "3.2.1",
5
5
  "description": "A luau beautifier and minifier.",
6
6
  "publisher": "centurion",
7
7
  "main": "./index.js",
package/src/main.js CHANGED
@@ -566,13 +566,22 @@ function layout(input) {
566
566
  blockBases.push({
567
567
  paren: parenDepth,
568
568
  brace: braceDepth,
569
- bracket: bracketDepth
569
+ bracket: bracketDepth,
570
+ lineStart: lines.length
570
571
  });
571
572
  }
572
573
 
573
574
  function leaveBlock() {
574
575
  if (blockBases.length > 1) {
575
- blockBases.pop();
576
+ const block = blockBases.pop();
577
+ // No statement line was emitted since the block opened, so the body
578
+ // is empty — leave a placeholder comment at the block's indent.
579
+ if (lines.length === block.lineStart) {
580
+ lines.push({
581
+ depth: Math.max(0, depth),
582
+ tokens: ["-- empty block"]
583
+ });
584
+ }
576
585
  }
577
586
  }
578
587
 
@@ -626,6 +635,7 @@ function layout(input) {
626
635
  }
627
636
 
628
637
  if (blockEnd.has(token) && atStatementLevel()) {
638
+
629
639
  flushCurrent();
630
640
  leaveBlock();
631
641
  depth = Math.max(0, depth - 1);