File tree Expand file tree Collapse file tree 5 files changed +83
-8
lines changed
test/testcases/indentation Expand file tree Collapse file tree 5 files changed +83
-8
lines changed Original file line number Diff line number Diff line change 44
55- Fixed broken indentation after case with OpOr pattern, fixes [ #576 ] ( https://github.com/HaxeCheckstyle/haxe-formatter/issues/576 )
66- Fixed missing linebreak between metadata and doc comment, fixes [ #578 ] ( https://github.com/HaxeCheckstyle/haxe-formatter/issues/578 )
7+ - Fixed indentation in anon function body, fixes [ #577 ] ( https://github.com/HaxeCheckstyle/haxe-formatter/issues/577 )
78- Changed default wrapping location of ` casePattern ` to ` afterLast ` , fixes [ #579 ] ( https://github.com/HaxeCheckstyle/haxe-formatter/issues/579 )
89
910## version 1.10.0 (2020-04-11)
Original file line number Diff line number Diff line change 11package formatter .marker ;
22
3+ import formatter .config .Config ;
4+ import formatter .config .IndentationConfig ;
35#if debugIndent
4- import haxe .PosInfos ;
56import sys .io .File ;
67import sys .io .FileOutput ;
78#end
8- import formatter .config .IndentationConfig ;
99
1010class Indenter {
1111 var config : IndentationConfig ;
1212 var parsedCode : Null <ParsedCode >;
1313
14- public function new (config : IndentationConfig ) {
15- this .config = config ;
14+ public function new (config : Config ) {
15+ this .config = fconfig ;
1616 if (config .character .toLowerCase () == " tab" ) {
1717 config .character = " \t " ;
1818 }
@@ -311,6 +311,12 @@ class Indenter {
311311 while (firstToken != null && ! parsedCode .tokenList .isNewLineBefore (firstToken .token )) {
312312 firstToken = parsedCode .tokenList .getPreviousToken (firstToken .token );
313313 }
314+ var brOpen : Null <TokenTree > = prevToken .access ().firstOf (BrOpen ).token ;
315+ if (brOpen != null ) {
316+ if (! parsedCode .tokenList .isSameLineBetween (prevToken , brOpen , false )) {
317+ continue ;
318+ }
319+ }
314320 return count + calcIndent (firstToken .token );
315321 }
316322 default :
Original file line number Diff line number Diff line change 11package formatter .marker ;
22
3- import haxe .zip .Entry ;
43import haxeparser .HaxeLexer ;
4+ import tokentree .TokenStream ;
55import tokentree .TokenStreamProgress ;
66import tokentree .walk .WalkStatement ;
7- import tokentree .TokenStream ;
87import formatter .codedata .CodeLines ;
98import formatter .codedata .FormatterInputData ;
10- import formatter .codedata .ParseFile ;
119import formatter .codedata .ParsedCode ;
12- import formatter .codedata .TokenData ;
1310
1411class MarkTokenText extends MarkerBase {
1512 public function run () {
Original file line number Diff line number Diff line change 1+ {}
2+
3+ ---
4+
5+ class PlayState extends FlxState
6+ {
7+ function createAttachmentControls():Void
8+ {
9+ add(attachmentDropDown = new FlxUIDropDownMenu(modelDropDownLoc.x, modelDropDownLoc.y - 30,
10+ FlxUIDropDownMenu.makeStrIdLabelArray(FlxGamepadAttachment.getConstructors()), function(attachment)
11+ {
12+ var gamepad = FlxG.gamepads.lastActive;
13+ if (gamepad != null)
14+ gamepad.attachment = FlxGamepadAttachment.createByName(attachment);
15+ updateConnectedGamepads(true);
16+ }, new FlxUIDropDownHeader(150)));
17+ }
18+ }
19+
20+ ---
21+
22+ class PlayState extends FlxState {
23+ function createAttachmentControls():Void {
24+ add(attachmentDropDown = new FlxUIDropDownMenu(modelDropDownLoc.x, modelDropDownLoc.y - 30,
25+ FlxUIDropDownMenu.makeStrIdLabelArray(FlxGamepadAttachment.getConstructors()), function(attachment) {
26+ var gamepad = FlxG.gamepads.lastActive;
27+ if (gamepad != null)
28+ gamepad.attachment = FlxGamepadAttachment.createByName(attachment);
29+ updateConnectedGamepads(true);
30+ }, new FlxUIDropDownHeader(150)));
31+ }
32+ }
Original file line number Diff line number Diff line change 1+ {
2+ "lineEnds": {
3+ "leftCurly": "both"
4+ }
5+ }
6+
7+ ---
8+
9+ class PlayState extends FlxState
10+ {
11+ function createAttachmentControls():Void
12+ {
13+ add(attachmentDropDown = new FlxUIDropDownMenu(modelDropDownLoc.x, modelDropDownLoc.y - 30,
14+ FlxUIDropDownMenu.makeStrIdLabelArray(FlxGamepadAttachment.getConstructors()), function(attachment)
15+ {
16+ var gamepad = FlxG.gamepads.lastActive;
17+ if (gamepad != null)
18+ gamepad.attachment = FlxGamepadAttachment.createByName(attachment);
19+ updateConnectedGamepads(true);
20+ }, new FlxUIDropDownHeader(150)));
21+ }
22+ }
23+
24+ ---
25+
26+ class PlayState extends FlxState
27+ {
28+ function createAttachmentControls():Void
29+ {
30+ add(attachmentDropDown = new FlxUIDropDownMenu(modelDropDownLoc.x, modelDropDownLoc.y - 30,
31+ FlxUIDropDownMenu.makeStrIdLabelArray(FlxGamepadAttachment.getConstructors()), function(attachment)
32+ {
33+ var gamepad = FlxG.gamepads.lastActive;
34+ if (gamepad != null)
35+ gamepad.attachment = FlxGamepadAttachment.createByName(attachment);
36+ updateConnectedGamepads(true);
37+ }, new FlxUIDropDownHeader(150)));
38+ }
39+ }
You can’t perform that action at this time.
0 commit comments