Skip to content

Commit

Permalink
fixed linebreak in type parameter, fixes #494 (#507)
Browse files Browse the repository at this point in the history
* fixed linebreak in type parameter, fixes #494
  • Loading branch information
AlexHaxe authored Jun 13, 2019
1 parent b8f7047 commit a495380
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 3 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

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

## version 1.8.0 (2019-06-13)

- Added `sameLine.returnBodySingleLine`, fixes [#303](https://github.com/HaxeCheckstyle/haxe-formatter/issues/303) ([#483](https://github.com/HaxeCheckstyle/haxe-formatter/issues/483))
- Added `emptyLines.*.existingBetweenFields`, fixes [#455](https://github.com/HaxeCheckstyle/haxe-formatter/issues/455) ([#484](https://github.com/HaxeCheckstyle/haxe-formatter/issues/484))
- Added printing config filename in verbose mode, fixes [#460](https://github.com/HaxeCheckstyle/haxe-formatter/issues/460) ([#493](https://github.com/HaxeCheckstyle/haxe-formatter/issues/493))
Expand All @@ -19,6 +21,7 @@
- Fixed nested inline array comprehension, fixes [#498](https://github.com/HaxeCheckstyle/haxe-formatter/issues/498) ([#501](https://github.com/HaxeCheckstyle/haxe-formatter/issues/501))
- Fixed incorrect comment closing, fixes [#500](https://github.com/HaxeCheckstyle/haxe-formatter/issues/500) ([#501](https://github.com/HaxeCheckstyle/haxe-formatter/issues/501))
- Fixed imports with conditionals, fixes [#504](https://github.com/HaxeCheckstyle/haxe-formatter/issues/504) ([#505](https://github.com/HaxeCheckstyle/haxe-formatter/issues/505))
- Fixed line break in type parameters, fixes [#494](https://github.com/HaxeCheckstyle/haxe-formatter/issues/494) ([#507](https://github.com/HaxeCheckstyle/haxe-formatter/issues/507))
- Changed `sameLine.returnBody` to only apply to multiline or loop/switch/try/if expressions, fixes [#303](https://github.com/HaxeCheckstyle/haxe-formatter/issues/303) ([#483](https://github.com/HaxeCheckstyle/haxe-formatter/issues/483))

## version 1.7.1 (2019-06-01)
Expand Down
4 changes: 2 additions & 2 deletions haxelib.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
"style"
],
"description": "A code formatter for Haxe",
"version": "1.7.1",
"releasenote": "Bugfixes - see CHANGELOG for details.",
"version": "1.8.0",
"releasenote": "Added same line options, empty lines options and an indentation setting for case labels and bugfixes - see CHANGELOG for details.",
"contributors": [
"AlexHaxe",
"Gama11"
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "haxe-formatter",
"version": "1.7.1",
"version": "1.8.0",
"description": "A code formatter for Haxe",
"repository": {
"type": "git",
Expand Down
5 changes: 5 additions & 0 deletions src/formatter/marker/wrapping/MarkWrappingBase.hx
Original file line number Diff line number Diff line change
Expand Up @@ -621,6 +621,11 @@ class MarkWrappingBase extends MarkerBase {
return endToken;
}
switch (next.token.tok) {
case Binop(OpGt):
if (next.token.access().parent().is(Binop(OpLt)).exists()) {
return endToken;
}
return findItemEnd(next.token);
case Binop(_):
return findItemEnd(next.token);
case CommentLine(_), Comment(_):
Expand Down
17 changes: 17 additions & 0 deletions test/testcases/wrapping/issue_494_type_parameter.hxtest
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{}

---

typedef HaxeRequestMethod<TParams, TResponse> = RequestMethod<TParams, TResponse, ResponseErrorData>;
typedef HaxeRequestMethod<TParams, TResponse, ResponseErrorData,TParams, TResponse, ResponseErrorData> = RequestMethod<TParams, TResponse, ResponseErrorData, TParams, TResponse, ResponseErrorData>;

typedef HaxeNotificationMethod<TParams> = NotificationMethod<TParams>;

---

typedef HaxeRequestMethod<TParams, TResponse> = RequestMethod<TParams, TResponse, ResponseErrorData>;

typedef HaxeRequestMethod<TParams, TResponse, ResponseErrorData, TParams, TResponse,
ResponseErrorData> = RequestMethod<TParams, TResponse, ResponseErrorData, TParams, TResponse, ResponseErrorData>;

typedef HaxeNotificationMethod<TParams> = NotificationMethod<TParams>;

0 comments on commit a495380

Please sign in to comment.