auto-indentation in javascript file



  • how to get auto-indent function in javascript file? any hint? any plug-in?



  • @Adriano-Ellero

    go to plugins > plugins admin and install jstool.
    (jstool is available on both 64 bit and 32 bit versions of notepad++)

    after installing jstool, open up any unformatted .js file in notepad++ and go to plugins > jstool > jsformat

    here is a larger unformatted .js file (jquery compressed), if you need something to test on: https://code.jquery.com/jquery-3.3.1.min.js
    (this is a good file for testing, as it has 86kb of code in just 3 lines, which will be expanded to readable 118kb in 4157 lines, after running jsformat)

    note: i did not find any plugins, that are able to correctly format/indent mixed html and js code.
    if you have mixed html/js files, you currently have to copy the js code part(s) to a new tab, run plugins > jstool > jsformat from there, and then copy/paste the formatted js back to your mixed html/js file, replacing the unformatted js code part.



  • thanks it works!!!