If I use distinct var
statements like
function stretchDiv(){
var wh = $(window).height();
var sz2 = wh - ((paddingTop + paddingBottom) + (mainTop + 2) * 2);
// the scrollbar happens only when the height of the elt is constrained
var sz3 = sz2 - outTop - 2;
$('#out').css({'height': sz3 + 'px'});
}
then JSLint complains, telling me to combine the second and third with the previous.
If I follow that advice, JSLint is happy, but Emacs' builtin js-mode.el (Emacs v23.2) does not indent the additional var
declarations the way I want. Also, it does not do the font-lock on the additional variables. See:
function stretchDiv(){
var wh = $(window).height(),
sz2 = wh - ((paddingTop + paddingBottom) + (mainTop + 2) * 2),
// the scrollbar happens only when the height of the elt is constrained
sz3 = sz2 - outTop - 2;
$('#out').css({'height': sz3 + 'px'});
}
How can I get the proper indentation and font-locking?
A forked version of js2-mode does exactly what you want.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With