Visual Studio indenting and regions collapsing

Topics: General
Nov 21, 2013 at 6:42 PM
Hey.

I'd like to suggest you guys to use the same "code formatting/indenting" engine that is used on javascript, also for typescript editor (the same or something inherited from it). I don't know if you guys are the responsible on embedding the TS in the Visual Studio, but anyway, I think you could forward this, so here are the reasons:

Code Indentation
In JS file, I can format my code as follow:
$.get(url, null, null, "json").done(function (data)
{
    //ok
})
.fail(function (err)
{
    //fail
});
And, if I press Ctrl+K+D (reformat), the engine respects the way it is formatted.
But if I reformat the same code above in a TS file, the result is:
$.get(url, null, null, "json").done(function (data)
{
    //ok
})
    .fail(function (err)
    {
        //fail
    });
It throws the .fail to right!


Regions collapsing
I'm used to code with brackets in new lines. The typescript options permits me to set the brackets on new lines. Also, I like to collapse the functions so I can give a quick look if the class face is pretty. But, collapsing + brackes on new lines are behaving a little weird. See:
In a JS file, if I collapse the functions, I got this visual.
    method1() [...]
    method2() [...]
    method3() [...]
Beautifull collapsed!

But in a TS file, the visual is:
    method1()
[...]
    method2()
[...]
    method3()
[...]
It shows the double of lines, and causes the lose of focus, because the method is indented, and the collapsed glyph is always at first column, no matter where the code starts.
Nov 22, 2013 at 7:34 PM
Found another issue. When using "lambda" on defining methods, the block collapsing does not work.
Example:
    //this does not collapse
    loadNextPage = () =>
    {
        this.loadNextPageWithCallbacks();
    }

    //neither
    loadNextPage = () => {
        this.loadNextPageWithCallbacks();
    }
Coordinator
Nov 25, 2013 at 3:51 PM
Thanks for the suggestion! We've definitely got some polish to do on the code formatting side.
Coordinator
Nov 25, 2013 at 3:55 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.