I suggest you ...

Javascript code formatter (indentation)

Here is an example of javascript code formatter http://javascript.about.com/library/blformat.htm <-- it's using client-side JS to indent the JS!

Please incorporate such indentation feature in JS and hook the indentation shortcut for JS too as we have in C# (CTRL+K+D)

Thank you.

16 votes
Vote
Sign in
Check!
(thinking…)
Reset
or sign in with
  • facebook
  • google
    Password icon
    I agree to the terms of service
    Signed in as (Sign out)
    You have left! (?) (thinking…)
    Real McCoyReal McCoy shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →

    2 comments

    Sign in
    Check!
    (thinking…)
    Reset
    or sign in with
    • facebook
    • google
      Password icon
      I agree to the terms of service
      Signed in as (Sign out)
      Submitting...
      • Real McCoyReal McCoy commented  ·   ·  Flag as inappropriate

        I have tried Ctrl+K, Ctrl+D for a javascript file, but it does not format the code correctly.

        To understand the scenario, please take a "minified JavaScript" file (say https://ajax.aspnetcdn.com/ajax/jquery/jquery-1.6.2.min.js) and open in VS2012 > Press Ctrl+K, Ctrl+D.

        You will notice that the code is not formatted with line breaks and indentation.

        Now copy paste the content of the same file in http://javascript.about.com/library/blformat.htm and press format.

        blformat is a library developed in Javascript (client-side), which may give you some reference how to carry out this task.

      • Chris SellsChris Sells commented  ·   ·  Flag as inappropriate

        In fact, you can use Ctrl+K, Ctrl+D to reformat your JS in the BUILD version of VS10 already. Give it a try and let us know what you think.

      Feedback and Knowledge Base