Home Download Buy Blog Forum Support

reindent and comments in javascript

reindent and comments in javascript

Postby pharrisee on Thu Jun 21, 2012 9:05 am

Hi,

I've mapped the reindent command to a hotkey:

{"keys": ["f12"], "command": "reindent", "args": {"single_line": false}}

I've noticed though that when I'm editing an HTML page (with javascript embedded) that the javascript reindentation for comments doesn't work, given this text:

Code: Select all
function addFields3(event){
        var num = $('.cloned-input3').length; // how many entries do we currently have?
        var newNum = new Number(num+1); // the new number

        // create a new container
        var container = $('#clone3-1').clone().attr('id','clone3-' +newNum);
        // insert the thing into the page
        $("#clone3-"+num).after(container);
//now we need to iterate round the controls and fix the id's
fixFields($('#clone3-'+newNum).contents(), newNum);
        // enable the "remove" button
        $('#btnDel').attr('disabled','');
        return false;
}


I would have expected the reindent command to change it to look like this:

Code: Select all
function addFields3(event){
        var num = $('.cloned-input3').length; // how many entries do we currently have?
        var newNum = new Number(num+1); // the new number

        // create a new container
        var container = $('#clone3-1').clone().attr('id','clone3-' +newNum);
        // insert the thing into the page
        $("#clone3-"+num).after(container);
        //now we need to iterate round the controls and fix the id's
        fixFields($('#clone3-'+newNum).contents(), newNum);
        // enable the "remove" button
        $('#btnDel').attr('disabled','');
        return false;
}


or something similar. Am I missing something? Is there a setting that disallows the reindentation of comments?

Although it's not a major problem, it's an itch that I keep having to scratch manually.

Thanks for any help or ideas.
pharrisee
 
Posts: 1
Joined: Thu Jun 21, 2012 8:57 am

Return to Technical Support

Who is online

Users browsing this forum: No registered users and 21 guests