):Bool {}
13 | }
14 |
--------------------------------------------------------------------------------
/test/testcases/whitespace/issue_92_detect_function_style.hxtest:
--------------------------------------------------------------------------------
1 | {}
2 |
3 | ---
4 |
5 | typedef RequestHandler = P->CancellationToken->(R->Void)->(ResponseError->Void)->Void;
6 |
7 | ---
8 |
9 | typedef RequestHandler = P->CancellationToken->(R->Void)->(ResponseError->Void)->Void;
10 |
--------------------------------------------------------------------------------
/test/testcases/whitespace/issue_95_optional_enum_constuctor_arg.hxtest:
--------------------------------------------------------------------------------
1 | {}
2 |
3 | ---
4 |
5 | enum Item {
6 | Staff(block:Float, ?magic:Int);
7 | }
8 |
9 | ---
10 |
11 | enum Item {
12 | Staff(block:Float, ?magic:Int);
13 | }
14 |
--------------------------------------------------------------------------------
/test/testcases/whitespace/mark_arrow_npe_with_conditionals.hxtest:
--------------------------------------------------------------------------------
1 | {}
2 |
3 | ---
4 |
5 | function prepareToSong()
6 | {
7 | #if (target.threaded)
8 | Thread.create(() -> {
9 | #end
10 | completedThread();
11 | #if (target.threaded)
12 | });
13 | #end
14 | }
15 |
16 | ---
17 |
18 | function prepareToSong() {
19 | #if (target.threaded)
20 | Thread.create(() -> {
21 | #end
22 | completedThread();
23 | #if (target.threaded)
24 | });
25 | #end
26 | }
27 |
--------------------------------------------------------------------------------
/test/testcases/whitespace/negative_int.hxtest:
--------------------------------------------------------------------------------
1 | {
2 | }
3 |
4 | ---
5 |
6 | class Main {
7 | static function main() {
8 | var exitCode:Int = try Sys.command(cmd, args) catch (e:Dynamic) -1;
9 | var exitCode:Int = if (true) -1 else -2;
10 | }
11 | }
12 |
13 | ---
14 |
15 | class Main {
16 | static function main() {
17 | var exitCode:Int = try Sys.command(cmd, args) catch (e:Dynamic) -1;
18 | var exitCode:Int = if (true) -1 else -2;
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/test/testcases/whitespace/not_with_popen.hxtest:
--------------------------------------------------------------------------------
1 | {
2 | "whitespace": {
3 | "parenConfig": {
4 | "funcParamParens": {
5 | "openingPolicy": "before"
6 | },
7 | "callParens": {
8 | "openingPolicy": "before"
9 | }
10 | }
11 | }
12 | }
13 |
14 | ---
15 |
16 | class Main {
17 | function main() {
18 | var x = (! (last is PfostenGruppe));
19 | }
20 | }
21 |
22 | ---
23 |
24 | class Main {
25 | function main () {
26 | var x = (!(last is PfostenGruppe));
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/test/testcases/whitespace/single_line_comments.hxtest:
--------------------------------------------------------------------------------
1 | {}
2 |
3 | ---
4 |
5 | class Main{
6 | //*************************
7 | // Test
8 | // Test
9 | //Test
10 | ///////////////////////////
11 | static function main(){}
12 | }
13 |
14 | ---
15 |
16 | class Main {
17 | //*************************
18 | // Test
19 | // Test
20 | // Test
21 | ///////////////////////////
22 | static function main() {}
23 | }
24 |
--------------------------------------------------------------------------------
/test/testcases/whitespace/single_line_comments_no_space.hxtest:
--------------------------------------------------------------------------------
1 | {
2 | "whitespace" : {
3 | "addLineCommentSpace": false
4 | }
5 | }
6 |
7 | ---
8 |
9 | class Main{
10 | //*************************
11 | // Test
12 | // Test
13 | //Test
14 | ///////////////////////////
15 | static function main(){}
16 | }
17 |
18 | ---
19 |
20 | class Main {
21 | //*************************
22 | // Test
23 | // Test
24 | //Test
25 | ///////////////////////////
26 | static function main() {}
27 | }
28 |
--------------------------------------------------------------------------------
/test/testcases/whitespace/space_in_anonymous_object.hxtest:
--------------------------------------------------------------------------------
1 | {}
2 |
3 | ---
4 |
5 | class Main
6 | {
7 | static public function main()
8 | {
9 | var report = {
10 | coverage:{
11 |
12 | }
13 | };
14 | }
15 | }
16 |
17 | ---
18 |
19 | class Main {
20 | static public function main() {
21 | var report = {
22 | coverage: {}
23 | };
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/test/testcases/whitespace/space_inside_anon_type_hint.hxtest:
--------------------------------------------------------------------------------
1 | {
2 | "indentation": {
3 | "character": " "
4 | },
5 | "whitespace" : {
6 | "bracesConfig": {
7 | "anonTypeBraces": {
8 | "openingPolicy": "around",
9 | "closingPolicy": "around",
10 | "removeInnerWhenEmpty": false
11 | }
12 | }
13 | }
14 | }
15 |
16 | ---
17 |
18 | interface Test {
19 | public function peer():{ host:Host };
20 | }
21 |
22 | ---
23 |
24 | interface Test {
25 | public function peer():{ host:Host };
26 | }
27 |
--------------------------------------------------------------------------------
/test/testcases/whitespace/static_locals.hxtest:
--------------------------------------------------------------------------------
1 | {
2 | }
3 |
4 | ---
5 |
6 | class Main {
7 | static function main() {
8 | static final @Test a = 1, b = 2;
9 | static var c, d;
10 | final e = 2;
11 | var f;
12 | }
13 | }
14 |
15 | ---
16 |
17 | class Main {
18 | static function main() {
19 | static final @Test a = 1, b = 2;
20 | static var c, d;
21 | final e = 2;
22 | var f;
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/test/testcases/whitespace/typedef_extension_gt_space.hxtest:
--------------------------------------------------------------------------------
1 | {}
2 |
3 | ---
4 |
5 | typedef Foo = {};
6 |
7 | typedef Foo = {}
8 |
9 | typedef Bar = {
10 | > Foo, var foo:Int; var bar:Int;
11 | }
12 |
13 | ---
14 |
15 | typedef Foo = {};
16 | typedef Foo = {}
17 |
18 | typedef Bar = {
19 | > Foo,
20 | var foo:Int;
21 | var bar:Int;
22 | }
23 |
--------------------------------------------------------------------------------
/test/testcases/whitespace/var_meta_data.hxtest:
--------------------------------------------------------------------------------
1 | {}
2 |
3 | ---
4 |
5 | class Main {
6 | function main () {
7 | var @:name name = 'Foo';
8 | }
9 | }
10 |
11 | ---
12 |
13 | class Main {
14 | function main() {
15 | var @:name name = 'Foo';
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/test/testcases/whitespace/whitespace_after_object_literal.hxtest:
--------------------------------------------------------------------------------
1 | {
2 | }
3 |
4 | ---
5 |
6 |
7 | class Main {
8 | static function main() {
9 | switch (foo) {
10 | case {kind: TkIdent, text: "error"}:
11 | doSomething();
12 | }
13 | {f: macro ${a},}
14 | }
15 | }
16 |
17 | ---
18 |
19 | class Main {
20 | static function main() {
21 | switch (foo) {
22 | case {kind: TkIdent, text: "error"}:
23 | doSomething();
24 | }
25 | {f: macro ${a},}
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/test/testcases/whitespace/whitespace_after_type_parameter.hxtest:
--------------------------------------------------------------------------------
1 | {
2 | "whitespace": {
3 | "parenConfig": {
4 | "funcParamParens": {
5 | "openingPolicy": "before"
6 | }
7 | }
8 | }
9 | }
10 |
11 |
12 | ---
13 |
14 |
15 | class Main {
16 | static function main():Array {}
17 | }
18 |
19 | ---
20 |
21 | class Main {
22 | static function main ():Array {}
23 | }
24 |
--------------------------------------------------------------------------------
/test/testcases/wrapping/array_of_3_objects.hxtest:
--------------------------------------------------------------------------------
1 | {}
2 |
3 | ---
4 |
5 | class Main {
6 | var fields:Array = [{field: "type", expr: macro "object"},
7 | {field: "properties", expr: props},
8 | {field: "additionalProperties", expr: macro false}];
9 | }
10 |
11 | ---
12 |
13 | class Main {
14 | var fields:Array = [
15 | {field: "type", expr: macro "object"},
16 | {field: "properties", expr: props},
17 | {field: "additionalProperties", expr: macro false}
18 | ];
19 | }
20 |
--------------------------------------------------------------------------------
/test/testcases/wrapping/issue_155_single_line_comments_in_array.hxtest:
--------------------------------------------------------------------------------
1 | {}
2 |
3 | ---
4 |
5 | class Main
6 | {
7 | public static inline function hex2rgb(hex:Int):Array {
8 | return [hex >> 16 & 0xFF, //R
9 | hex >> 8 & 0xFF, //G
10 | hex & 0xFF]; //B
11 | }
12 | }
13 |
14 | ---
15 |
16 | class Main {
17 | public static inline function hex2rgb(hex:Int):Array {
18 | return [hex >> 16 & 0xFF, // R
19 | hex >> 8 & 0xFF, // G
20 | hex & 0xFF]; // B
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/test/testcases/wrapping/issue_180_middle_of_function_call.hxtest:
--------------------------------------------------------------------------------
1 | {}
2 |
3 | ---
4 |
5 | class Main {
6 | public static function main() {
7 | commands.executeCommand("editor.action.showReferences", Uri.parse(uri), copyPosition(position), locations).then(function(s) trace(s), function(s) trace("err: " + s));
8 | }
9 | }
10 |
11 | ---
12 |
13 | class Main {
14 | public static function main() {
15 | commands.executeCommand("editor.action.showReferences", Uri.parse(uri), copyPosition(position), locations)
16 | .then(function(s) trace(s), function(s) trace("err: " + s));
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/test/testcases/wrapping/issue_192_wrapping_function_with_comment.hxtest:
--------------------------------------------------------------------------------
1 | {}
2 |
3 | ---
4 |
5 | class Main {
6 | public static function open(url:String = null, floating:Bool = false,
7 | ?useWideViewPort:Bool = false // Android only
8 | ):Void {}
9 | }
10 |
11 | ---
12 |
13 | class Main {
14 | public static function open(url:String = null, floating:Bool = false, ?useWideViewPort:Bool = false // Android only
15 | ):Void {}
16 | }
17 |
--------------------------------------------------------------------------------
/test/testcases/wrapping/issue_238_keep_wrapping_array.hxtest:
--------------------------------------------------------------------------------
1 | {
2 | "wrapping": {
3 | "arrayWrap": {
4 | "defaultWrap": "keep",
5 | "rules": []
6 | }
7 | }
8 | }
9 |
10 | ---
11 |
12 | class Main {
13 | static function main():Void {
14 | var arr = [
15 | 0,
16 | 0, 0, //test comment
17 | 0, 0,
18 | 0,
19 | ];
20 | }
21 | }
22 |
23 | ---
24 |
25 | class Main {
26 | static function main():Void {
27 | var arr = [
28 | 0,
29 | 0, 0, // test comment
30 | 0, 0,
31 | 0,
32 | ];
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/test/testcases/wrapping/issue_238_keep_wrapping_call.hxtest:
--------------------------------------------------------------------------------
1 | {
2 | "wrapping": {
3 | "callParameter": {
4 | "defaultWrap": "keep",
5 | "rules": []
6 | }
7 | }
8 | }
9 |
10 | ---
11 |
12 | class Main {
13 | static function main():Void {
14 | g.drawImage(
15 | tileset.img,
16 | ix * tileSize,
17 | iy * tileSize,
18 | tileSize, tileSize
19 | );
20 | }
21 | }
22 |
23 | ---
24 |
25 | class Main {
26 | static function main():Void {
27 | g.drawImage(
28 | tileset.img,
29 | ix * tileSize,
30 | iy * tileSize,
31 | tileSize, tileSize
32 | );
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/test/testcases/wrapping/issue_238_keep_wrapping_function_signature.hxtest:
--------------------------------------------------------------------------------
1 | {
2 | "wrapping": {
3 | "functionSignature": {
4 | "defaultWrap": "keep",
5 | "rules": []
6 | }
7 | }
8 | }
9 |
10 | ---
11 |
12 | class Main {
13 | public static inline function matrix(
14 | scaleX = 1.0, skewX = 0.0,
15 | moveX = 0.0, skewY = 0.0,
16 | scaleY = 1.0, moveY = 0.0
17 | ):FastMatrix3 {
18 | }
19 | }
20 |
21 | ---
22 |
23 | class Main {
24 | public static inline function matrix(
25 | scaleX = 1.0, skewX = 0.0,
26 | moveX = 0.0, skewY = 0.0,
27 | scaleY = 1.0, moveY = 0.0
28 | ):FastMatrix3 {}
29 | }
30 |
--------------------------------------------------------------------------------
/test/testcases/wrapping/issue_238_keep_wrapping_return_call.hxtest:
--------------------------------------------------------------------------------
1 | {
2 | "wrapping": {
3 | "callParameter": {
4 | "defaultWrap": "keep",
5 | "rules": []
6 | }
7 | }
8 | }
9 |
10 | ---
11 |
12 | class Main {
13 | static function main():Void {
14 | return new FastMatrix3(
15 | scaleX, skewX, moveX,
16 | skewY, scaleY, moveY,
17 | 0, 0, 1
18 | );
19 | }
20 | }
21 |
22 | ---
23 |
24 | class Main {
25 | static function main():Void {
26 | return new FastMatrix3(
27 | scaleX, skewX, moveX,
28 | skewY, scaleY, moveY,
29 | 0, 0, 1
30 | );
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/test/testcases/wrapping/issue_311_line_break_before_popen.hxtest:
--------------------------------------------------------------------------------
1 | {
2 | }
3 |
4 | ---
5 |
6 | class Main {
7 | public static function main() {
8 | window.showQuickPick(items, {placeHolder: "Select Haxe Completion Provider"}).then(item -> if (item != null)
9 | displayArguments.selectProvider(item.label));
10 | }
11 | }
12 |
13 | ---
14 |
15 | class Main {
16 | public static function main() {
17 | window.showQuickPick(items, {placeHolder: "Select Haxe Completion Provider"})
18 | .then(item -> if (item != null) displayArguments.selectProvider(item.label));
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/test/testcases/wrapping/issue_439_wrapping_function_header.hxtest:
--------------------------------------------------------------------------------
1 | {
2 | }
3 |
4 | ---
5 |
6 | class Main {
7 | override function setFunctionBreakPointsRequest(response:SetFunctionBreakpointsResponse, args:SetFunctionBreakpointsArguments) {
8 | foo;
9 | }
10 | }
11 |
12 | ---
13 |
14 | class Main {
15 | override function setFunctionBreakPointsRequest(response:SetFunctionBreakpointsResponse, args:SetFunctionBreakpointsArguments) {
16 | foo;
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/test/testcases/wrapping/issue_443_matrix_wrapping_with_comments.hxtest:
--------------------------------------------------------------------------------
1 | {
2 | }
3 |
4 | ---
5 |
6 | class Main {
7 | static function main() {
8 | foo([
9 | a, //
10 | b //
11 | ]);
12 | }
13 | }
14 |
15 | ---
16 |
17 | class Main {
18 | static function main() {
19 | foo([
20 | a, //
21 | b //
22 | ]);
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/test/testcases/wrapping/issue_444_array_wrapping_with_comments.hxtest:
--------------------------------------------------------------------------------
1 | {
2 | }
3 |
4 | ---
5 |
6 | class Main {
7 | static function main() {
8 | actualArgs = actualArgs.concat([
9 | "-D",
10 | "display-details", // get more details in completion results,
11 | "--no-output" // prevent any generation
12 | ]);
13 | }
14 | }
15 |
16 | ---
17 |
18 | class Main {
19 | static function main() {
20 | actualArgs = actualArgs.concat([
21 | "-D",
22 | "display-details", // get more details in completion results,
23 | "--no-output" // prevent any generation
24 | ]);
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/test/testcases/wrapping/issue_472_comment_parameter.hxtest:
--------------------------------------------------------------------------------
1 | {
2 | }
3 |
4 | ---
5 |
6 | extern class Foo {
7 | public function new(thickness:Float = 0 /*NaN*/, pixelHinting:Bool = false, ?scaleMode:LineScaleMode, ?caps:CapsStyle, ?joints:JointStyle,
8 | miterLimit:Float = 3, fill:IGraphicsFill = null);
9 | }
10 |
11 | ---
12 |
13 | extern class Foo {
14 | public function new(thickness:Float = 0 /*NaN*/, pixelHinting:Bool = false, ?scaleMode:LineScaleMode, ?caps:CapsStyle, ?joints:JointStyle,
15 | miterLimit:Float = 3, fill:IGraphicsFill = null);
16 | }
17 |
--------------------------------------------------------------------------------
/test/testcases/wrapping/issue_516_literal_wrapping_with_postfix_exclamation.hxtest:
--------------------------------------------------------------------------------
1 | {}
2 |
3 | ---
4 |
5 | class Main {
6 | static function main() {
7 | var object = {
8 | a: b,
9 | c: d!.e
10 | };
11 | }
12 | }
13 |
14 | ---
15 |
16 | class Main {
17 | static function main() {
18 | var object = {
19 | a: b,
20 | c: d!.e
21 | };
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/test/testcases/wrapping/issue_561_multiline_string_call_parameter_keep.hxtest:
--------------------------------------------------------------------------------
1 | {
2 | "wrapping": {
3 | "callParameter": {
4 | "defaultWrap": "keep"
5 | }
6 | }
7 | }
8 |
9 | ---
10 |
11 | class Main
12 | {
13 | private function someFunc()
14 | {
15 | return hxx('
16 |
17 | ');
18 | }
19 | }
20 |
21 | ---
22 |
23 | class Main {
24 | private function someFunc() {
25 | return hxx('
26 |
27 | ');
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/test/testcases/wrapping/issue_617_wrapping_of_arrow_function.hxtest:
--------------------------------------------------------------------------------
1 | {
2 | }
3 |
4 |
5 | ---
6 |
7 | class Main {
8 | public static function main() {
9 | return [
10 | foo.bar(dummy, dummy, dummy, dummy, dummy, dummy),
11 | () -> foo.bar(dummy, dummy, dummy, dummy, dummy),
12 | ];
13 | }
14 | }
15 |
16 | ---
17 |
18 | class Main {
19 | public static function main() {
20 | return [
21 | foo.bar(dummy, dummy, dummy, dummy, dummy, dummy),
22 | () -> foo.bar(dummy, dummy, dummy, dummy, dummy),
23 | ];
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/uglifyFormatter.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | mkdir -p bin
4 |
5 | npx uglify-js-es6 run.js -o bin/formatter.uglify.js
6 |
7 | echo '#!/usr/bin/env node' > bin/formatter.js
8 | echo "" >> bin/formatter.js
9 | cat bin/formatter.uglify.js >> bin/formatter.js
10 | chmod 755 bin/formatter.js
11 |
12 | rm bin/formatter.uglify.js
13 |
--------------------------------------------------------------------------------