Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

javascript visual studio 2013 indentation

I started playing around with javascript on Visual Studio 2013 and I couldn't figure out why it is not automatically positioning the cursor to the correct indentation level, instead always resetting back to the head. For example:

function foo(y) {
    var f = function bar(x) {
    |<-- cursor should be here, but ends up
|<-- over here
}

Does anyone else see this and how do you change it?

I have the typescript, nodejs plugin installed and that's about it.

like image 570
stewart99 Avatar asked Feb 17 '14 16:02

stewart99


1 Answers

With a bit of research, things started working for me. First check that, Tools -> Options -> Text Editor -> Javascript -> Tabs -> Indenting is set to 'Smart'. Next restart VS. For me restarting was important since, apparently, my file had some mixed line-endings and that was throwing off the indentation engine. Hope this helps someone.

like image 172
Samik R Avatar answered Nov 09 '22 17:11

Samik R