Sublime Forum

Javascript reindent doesnt work after few lines

#1

I know there is an issue of indentation when with comments but this is not that case.

This reindentation issue happens usually when there are too many lines of code.
The script indentation works until x lines and the rest of the code indentation starts from left again.

Try reindenting the below code and you would understand the exact issue.

The code on green indents correctly but the one in red doesn’t.

If i try deleting some lines from the green code and reindent again, it indents perfectly. Its totally weird, like there is a max characters/lines limit for indentation to work.

Any ideas what could be the issue?

-------------> Edit -> Line -> Reindent


jQuery(document).ready(function () {
jQuery(’.aaaaaaaaaaaaaaa’).on(‘aaaaaaaaaa’, ‘change’, function () {
if (jQuery(’#aaaaaaaaaaaaaaa input:radio:checked’).length > 0) {
if (jQuery(this).val() == ‘1’) {
jQuery(’#aaaaaaaaaaaaaaa’).attr(‘aaaaaaaaaaaaaaa’, ‘aaaaaaaaaaaaaaa’);
jQuery(’#aaaaaaaaaaaaaaa’).attr(‘aaaaaaaaaaaaaaa’, ‘aaaaaaaaaaaaaaa’);
jQuery(’#aaaaaaaaaaaaaaa #aaaaaaaaaaaaaaa’).next(‘span.aaaaaaaaaaaaaaa’).text(‘aaaaaaaaaaaaaaa’);
}
else if (jQuery(this).val() == ‘2’) {
jQuery(’#aaaaaaaaaaaaaaa’).val(jQuery(’#aaaaaaaaaaaaaaa’).val());
jQuery(’#aaaaaaaaaaaaaaa’).attr(‘aaaaaaaaaaaaaaa’, ‘aaaaaaaaaaaaaaa’);
jQuery(’#aaaaaaaaaaaaaaa #aaaaaaaaaaaaaaa’).next(‘span.aaaaaaaaaaaaaaa’).text(‘aaaaaaaaaaaaaaa’);
}
else if (jQuery(this).val() == ‘3’) {
jQuery(’#aaaaaaaaaaaaaaa’).val(jQuery(’#aaaaaaaaaaaaaaa’).val());
jQuery(’#aaaaaaaaaaaaaaa’).attr(‘aaaaaaaaaaaaaaa’, ‘aaaaaaaaaaaaaaa’);
jQuery(’#aaaaaaaaaaaaaaa #aaaaaaaaaaaaaaa’).next(‘span.aaaaaaaaaaaaaaa’).text(‘aaaaaaaaaaaaaaa’);
}
jQuery(’#aaaaaaaaaaaaaaa’).show();
}
else { jQuery(’#aaaaaaaaaaaaaaa’).hide(); }
});

jQuery(’.bbbbbbbbbbb’).on(’#bbbbbbbbbbb’, ‘change’, function () {
if (jQuery(’#bbbbbbbbbbb’).is(’:checked’)) {
jQuery(’.bbbbbbbbbbb’).show();
}
else { jQuery(’.bbbbbbbbbbb’).hide(); }
});

})

0 Likes