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

Wrapping with call after type check

Open Gama11 opened this issue 5 years ago • 1 comments

It seems confusing to have the .then on the same indent level as the type check here:

class Main {
	static function main() {
		window.showErrorMessage("No Haxe configurations are available. Please provide the haxe.displayConfigurations setting.",
			({title: "Edit settings"} : vscode.MessageItem))
			.then(function(button) {
				trace("");
			});
	}
}

The .then() part didn't used to be wrapped into a new line.

Gama11 avatar Apr 08 '19 23:04 Gama11

there is two competing wrapping rules at play here: methodChain and callParameter wrapping. The first one wraps at .then, but that doesn't satisfy maxLineLength, so the second one wraps at the second call parameter. I am afraid there is not much current wrapping logic can do here. This will have to wait until wrapping "version 5", where it learns to resolve multiple wrapping rules applying to the same line of code.

AlexHaxe avatar May 16 '19 10:05 AlexHaxe