diff --git a/.github/workflows/formatter.yml b/.github/workflows/formatter.yml index 6bdbd33..1d9d0f7 100644 --- a/.github/workflows/formatter.yml +++ b/.github/workflows/formatter.yml @@ -74,5 +74,5 @@ jobs: # name: formatter.js # path: bin/formatter.js - name: Upload results to codecov - if: success() && matrix.platform == 'ubuntu-latest' && (matrix.haxe-version == '4.2.5') + if: success() && matrix.platform == 'ubuntu-latest' && (matrix.haxe-version == 'nightly') run: bash <(curl -s https://codecov.io/bash) || echo "Codecov did not collect coverage reports" diff --git a/CHANGELOG.md b/CHANGELOG.md index 3cdf28c..4aca4c2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ## dev branch / next version (1.x.x) +## version 1.14.3 (2022-09-21) + +- Fixed whitespace issue in for loops when using parentheses around start value, fixes [vshaxe/vshaxe#545](https://github.com/vshaxe/vshaxe/issues/545) ([#658](https://github.com/HaxeCheckstyle/haxe-formatter/issues/658)) + ## version 1.14.2 (2022-09-14) - Updated haxeparser to support latest Haxe nightly syntax ([#657](https://github.com/HaxeCheckstyle/haxe-formatter/issues/657)) diff --git a/haxelib.json b/haxelib.json index a6c9d69..24e052a 100644 --- a/haxelib.json +++ b/haxelib.json @@ -8,8 +8,8 @@ "style" ], "description": "A code formatter for Haxe", - "version": "1.14.2", - "releasenote": "updated haxeparser to support latest Haxe nightly syntax - see CHANGELOG for details.", + "version": "1.14.3", + "releasenote": "fixed whitespace issue in for loop with parentheses - see CHANGELOG for details.", "contributors": [ "AlexHaxe", "Gama11" diff --git a/package-lock.json b/package-lock.json index a4122d2..9782ae2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@haxecheckstyle/haxe-formatter", - "version": "1.14.2", + "version": "1.14.3", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@haxecheckstyle/haxe-formatter", - "version": "1.14.2", + "version": "1.14.3", "license": "MIT", "bin": { "haxe-formatter": "bin/formatter.js" diff --git a/package.json b/package.json index 58ffb3e..69d7c0b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@haxecheckstyle/haxe-formatter", - "version": "1.14.2", + "version": "1.14.3", "description": "A code formatter for Haxe", "repository": { "type": "git", diff --git a/src/formatter/marker/MarkWhitespace.hx b/src/formatter/marker/MarkWhitespace.hx index 580dc8b..a61b8c1 100644 --- a/src/formatter/marker/MarkWhitespace.hx +++ b/src/formatter/marker/MarkWhitespace.hx @@ -17,7 +17,7 @@ class MarkWhitespace extends MarkerBase { markGt(token); case Spread | Binop(OpInterval): markOpSpread(token); - case Binop(OpIn): + case Binop(OpIn) | Kwd(KwdIn): markIn(token); case Binop(OpMult): if (TokenTreeCheckUtils.isImport(token.parent)) { diff --git a/test/testcases/whitespace/for_iterator_with_popen.hxtest b/test/testcases/whitespace/for_iterator_with_popen.hxtest new file mode 100644 index 0000000..4b76f0d --- /dev/null +++ b/test/testcases/whitespace/for_iterator_with_popen.hxtest @@ -0,0 +1,28 @@ +{ +} + +--- + +class Main { + static function main() { + for (i in (startLine + 1)...endLine) run(); + for (i in (startLine + 1)...(endLine-1)) run(); + for (i in startLine + 1...endLine) run(); + for (i in startLine + 1...endLine - 1) run(); + } +} + +--- + +class Main { + static function main() { + for (i in (startLine + 1)...endLine) + run(); + for (i in (startLine + 1)...(endLine - 1)) + run(); + for (i in startLine + 1...endLine) + run(); + for (i in startLine + 1...endLine - 1) + run(); + } +}