Open Qantas94Heavy opened 11 years ago
You can turn off "break lines on chained methods", and then turn on "preserve newlines". This won't enforce the structure, but it will preserve what you have:
// input - expected to be unchanged after beautify
this._foo = new Date().getTime().milliseconds();
// other input - also expected to be unchanged
this._foo = new Date().getTime()
.milliseconds();
Combine this with line wraps and you should get reasonable chains. If what I'm describing doesn't sound sufficient, could you give some more extensive examples? Include input, current output, and what you'd like to see.
I believe I'm experiencing something similar.
I have the following code:
angular
.module("app", []);
When I run beautify I get the following:
angular.module("app", []);
I want my first example to be unaffected by beautifying.
Any tips or hints?
@gilazo - set break_chained_methods
option to true
.
I have the same issue and turning off "break lines on chained methods" is not possible for in my case. Input:
daisy.chain().me().please();
undefined._foo = new Date().getTime();
$(document).ready(function () {
// function code here
});
$('foo').on('focus blur', function () {
var foo = bar;
}).on('click', function () {
var bar = foo;
});
output:
daisy.chain()
.me()
.please();
undefined._foo = new Date()
.getTime();
$(document)
.ready(function() {
// function code here
});
$('foo')
.on('focus blur', function() {
var foo = bar;
})
.on('click', function() {
var bar = foo;
});
desired output:
// i can live with this:
daisy.chain()
.me()
.please();
// i believe this is the latest convention:
daisy
.chain()
.me()
.please();
undefined._foo = new Date().getTime();
$(document).ready(function() {
// function code here
});
$('foo')
.on('focus blur', function() {
var foo = bar;
})
.on('click', function() {
var bar = foo;
});
Related to #809 ?
@joaobarcia - Sure. #809 would be the more flexible setting.
I'd like an option to allow single chained methods to be placed on same line, as in if there is only two calls, then those two are placed on the same line. Here are some examples of code that doesn't really look good with the current "break lines on chained methods" option:
Would this be feasible or is this just too much work for little gain?