Skip to content

Commit

Permalink
fixed curly with comments, fixes #445
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexHaxe committed Oct 1, 2024
1 parent 00262ab commit 3bd143c
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
- Fixed class fields with conditional function signatures
- Fixed abstract enum abstracts with conditionals
- Fixed map wrapping rules to avoid fill line wrapping
- Fixed curly with comments, fixes [#445](https://github.com/HaxeCheckstyle/haxe-formatter/issues/445)

## version 1.16.1 (2024-09-18)

Expand Down
33 changes: 33 additions & 0 deletions test/testcases/lineends/issue_445_curly_with_comment.hxtest
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{}

---

class Main
{
static function main()
{
if (foo)
{ // comment
bar;
} // comment
if (foo)
{
// comment
bar;
} // comment
}
}

---

class Main {
static function main() {
if (foo) { // comment
bar;
} // comment
if (foo) {
// comment
bar;
} // comment
}
}
42 changes: 42 additions & 0 deletions test/testcases/lineends/issue_445_curly_with_comment_both.hxtest
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"lineEnds": {
"leftCurly": "both",
"rightCurly": "both"
}
}

---

class Main
{
static function main()
{
if (foo)
{ // comment
bar;
} // comment
if (foo)
{
// comment
bar;
} // comment
}
}

---

class Main
{
static function main()
{
if (foo)
{ // comment
bar;
} // comment
if (foo)
{
// comment
bar;
} // comment
}
}

0 comments on commit 3bd143c

Please sign in to comment.