haxe-formatter icon indicating copy to clipboard operation
haxe-formatter copied to clipboard

Not breaking line after last function argument

Open fed239 opened this issue 6 years ago • 4 comments

Can I make so that formatter won't break line after last argument in function signatures (in long lines)? If possible how would I define this in hxformat.json?

My current hxformat.json in this part looks like this

		"functionSignature": {
			"defaultWrap": "fillLine",
			"defaultAdditionalIndent": 1,
			"rules": [
				{
					"conditions": [
						{
							"cond": "lineLength >= n",
							"value": 100
						}
					],
					"type": "onePerLine",
					"additionalIndent": 1
				}
                	]
		},

and I get functions formatted like this

function f(
    a:String,
    b:String,
    c:String
) {
  trace(a, b, c);
}

and I would like to get it like this

function f(
    a:String,
    b:String,
    c:String) {
  trace(a, b, c);
}

Thank a lot for you help and sorry if this is wrong place for asking questions.

fed239 avatar Jun 28 '19 14:06 fed239

BTW, can I find documentation about hxformat.json somewhere? At least reference of supported options and values would be good.

fed239 avatar Jun 28 '19 14:06 fed239

Hi, I transferred your issue over to formatter's issues.

right now there is no option to stop line breaks after last element in "onePerLine" mode

And there is also no real documentation on hxformat.json apart from a JSON schema that is integrated with VSCode that will help you by giving you autocompletion of options and values. It also shows tooltips for settings and their values. There is a dump of a fully filled out hxformat.json at https://github.com/HaxeCheckstyle/haxe-formatter/blob/master/resources/default-hxformat.json (or you can create one with haxelib run formatter --default-config default-hxformat.json).

AlexHaxe avatar Jun 28 '19 15:06 AlexHaxe

Hi Alex, Thank you for the explanation. Apologies for submitting issue to the wrong project.

fed239 avatar Jun 28 '19 17:06 fed239

no problem, luckily github has a transfer issue button :)

AlexHaxe avatar Jun 28 '19 17:06 AlexHaxe