Skip to content

Commit 897f5d1

Browse files
authored
indentation and wrapping fixes (#677)
* fixed comment indentation in empty switch cases, fixes #392, #174 * moved Java compile to Jvm * fixed doc comment indentation with conditionals, fixes #499 * fixed empty lines between static functions in abstracts, fixes #356 * fixed multiline string literals with empty lines, fixes #368 * fixed expressionIf for array comprehension, fixes #365 * added wrapping.mapWrap, fixes #675 * added formatter:off testcase, #676
1 parent 4562d6b commit 897f5d1

26 files changed

+564
-19
lines changed

.github/workflows/formatter.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
build:
1515
strategy:
1616
matrix:
17-
haxe-version: ['4.3.2', 'nightly']
17+
haxe-version: ['4.3.3', 'nightly']
1818
platform: [ubuntu-latest, macos-latest, windows-latest]
1919
runs-on: ${{ matrix.platform }}
2020
steps:
@@ -51,10 +51,9 @@ jobs:
5151
- name: Build JSON schema
5252
run: npx haxe buildSchema.hxml
5353
- name: Run eval tests
54-
if: (matrix.haxe-version == '4.3.2')
54+
if: (matrix.haxe-version == '4.3.3')
5555
run: npx haxe -D codecov_json test.hxml
5656
- name: Run Java tests
57-
if: (matrix.haxe-version == 'nightly')
5857
run: npx haxe -D codecov_json testJava.hxml
5958
- name: Run Node version with --check
6059
run: node run.js -s . --check
@@ -74,5 +73,5 @@ jobs:
7473
# name: formatter.js
7574
# path: bin/formatter.js
7675
- name: Upload results to codecov
77-
if: success() && matrix.platform == 'ubuntu-latest' && (matrix.haxe-version == '4.3.2')
76+
if: success() && matrix.platform == 'ubuntu-latest' && (matrix.haxe-version == '4.3.3')
7877
run: bash <(curl -s https://codecov.io/bash) || echo "Codecov did not collect coverage reports"

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,15 @@
22

33
## dev branch / next version (1.x.x)
44

5+
## version 1.16.0 (2024-02-10)
6+
7+
- Added `wrapping.mapWrap`, fixes [#675](https://github.com/HaxeCheckstyle/haxe-formatter/issues/675) ([#677](https://github.com/HaxeCheckstyle/haxe-formatter/issues/677))
8+
- Fixed comment indentation in empty switch cases, fixes [#392](https://github.com/HaxeCheckstyle/haxe-formatter/issues/392), [#174](https://github.com/HaxeCheckstyle/haxe-formatter/issues/174) ([#677](https://github.com/HaxeCheckstyle/haxe-formatter/issues/677))
9+
- Fixed multiline comment indentation with conditionals, fixes [#499](https://github.com/HaxeCheckstyle/haxe-formatter/issues/499) ([#677](https://github.com/HaxeCheckstyle/haxe-formatter/issues/677))
10+
- Fixed empty lines between static functions in abstract, fixes [#356](https://github.com/HaxeCheckstyle/haxe-formatter/issues/356) ([#677](https://github.com/HaxeCheckstyle/haxe-formatter/issues/677))
11+
- Fixed multiline string literals with empty lines, fixes [#368](https://github.com/HaxeCheckstyle/haxe-formatter/issues/368) ([#677](https://github.com/HaxeCheckstyle/haxe-formatter/issues/677))
12+
- Fixed expressionIf for array comprehension, fixes [#365](https://github.com/HaxeCheckstyle/haxe-formatter/issues/365) ([#677](https://github.com/HaxeCheckstyle/haxe-formatter/issues/677))
13+
514
## version 1.15.0 (2023-09-05)
615

716
- Added `sameLine.ifElseSemicolonNextLine` to allow breaking `if (true) foo; else foo;`, fixes [#612](https://github.com/HaxeCheckstyle/haxe-formatter/issues/612) ([#668](https://github.com/HaxeCheckstyle/haxe-formatter/issues/668))

buildJava.hxml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
buildCommon.hxml
2-
-D jvm
3-
-java out
2+
--jvm out/Cli.jar
43
-main formatter.Cli

display.hxml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@
1111
-lib munit
1212
-lib safety
1313
-lib test-adapter
14+
-lib instrument

haxe_libraries/tokentree.hxml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
# @install: lix --silent download "haxelib:/tokentree#1.2.10" into tokentree/1.2.10/haxelib
2-
-cp ${HAXE_LIBCACHE}/tokentree/1.2.10/haxelib/src
3-
-D tokentree=1.2.10
1+
# @install: lix --silent download "haxelib:/tokentree#1.2.11" into tokentree/1.2.11/haxelib
2+
-cp ${HAXE_LIBCACHE}/tokentree/1.2.11/haxelib/src
3+
-D tokentree=1.2.11

haxelib.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
"style"
99
],
1010
"description": "A code formatter for Haxe",
11-
"version": "1.15.0",
12-
"releasenote": " Added sameLine.ifElseSemicolonNextLine - see CHANGELOG for details.",
11+
"version": "1.16.0",
12+
"releasenote": "Added wrapping.mapWrap; fixed some indentation issues - see CHANGELOG for details.",
1313
"contributors": [
1414
"AlexHaxe",
1515
"Gama11"

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@haxecheckstyle/haxe-formatter",
3-
"version": "1.15.0",
3+
"version": "1.16.0",
44
"description": "A code formatter for Haxe",
55
"repository": {
66
"type": "git",

resources/default-hxformat.json

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -534,6 +534,69 @@
534534
}
535535
]
536536
},
537+
"mapWrap": {
538+
"defaultWrap": "noWrap",
539+
"rules": [
540+
{
541+
"conditions": [
542+
{
543+
"cond": "hasMultilineItems",
544+
"value": 1
545+
}
546+
],
547+
"type": "onePerLine"
548+
},
549+
{
550+
"conditions": [
551+
{
552+
"cond": "totalItemLength <= n",
553+
"value": 80
554+
}
555+
],
556+
"type": "noWrap"
557+
},
558+
{
559+
"conditions": [
560+
{
561+
"cond": "anyItemLength <= n",
562+
"value": 30
563+
},
564+
{
565+
"cond": "itemCount >= n",
566+
"value": 10
567+
}
568+
],
569+
"type": "fillLineWithLeadingBreak"
570+
},
571+
{
572+
"conditions": [
573+
{
574+
"cond": "anyItemLength >= n",
575+
"value": 30
576+
}
577+
],
578+
"type": "onePerLine"
579+
},
580+
{
581+
"conditions": [
582+
{
583+
"cond": "itemCount >= n",
584+
"value": 4
585+
}
586+
],
587+
"type": "onePerLine"
588+
},
589+
{
590+
"conditions": [
591+
{
592+
"cond": "exceedsMaxLineLength",
593+
"value": 1
594+
}
595+
],
596+
"type": "onePerLine"
597+
}
598+
]
599+
},
537600
"maxLineLength": 160,
538601
"metadataCallParameter": {
539602
"defaultWrap": "noWrap",

resources/hxformat-schema.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1285,6 +1285,10 @@
12851285
"description": "type parameter wrapping rules",
12861286
"$ref": "#/definitions/formatter.config.WrapRules"
12871287
},
1288+
"mapWrap": {
1289+
"description": "map literal wrapping rules does not affect map comprehension, use \"sameLine.comprehensionFor\"",
1290+
"$ref": "#/definitions/formatter.config.WrapRules"
1291+
},
12881292
"objectLiteral": {
12891293
"description": "object literal wrapping rules",
12901294
"$ref": "#/definitions/formatter.config.WrapRules"

0 commit comments

Comments
 (0)