Visual Studio 2017 JavaScript Comment Auto Formatting

Viewed 560

When I create a comment in Visual Studio 2017 inside a JavaScript file (.js) the automatic formatting of comments is different than how they are formatted when I am using C#. While a small issue, it would save some time in the long run to solve and figure out if this is possible in Visual Studio

In a C# file, when I type: /* and press enter, another asterisk is automatically created as well as a space before the asterisk, so they all are on the same line, as well as a space after the asterisk which is where my cursor ultimately ends up.

Example in C#:

/*
 * 

However, in JavaScript when I start a comment by typing /* and press enter the cursor simply moves to the next line. No spaces or asterisks are created.

Example in JavaScript:

/*
[Nothing is automatically created on this line after pressing enter.]

We are in the process of updating our JavaScript core libraries to use YUIDoc and will be adding a good deal of comments such as:

/**
 * My JavaScript application
 * 
 * @module myapp
 */

Having intellisense add the extra space and asterisk on enter would be a big time saver. I've reviewed the various settings in the Tools > Options > Text Editor and cannot seem to locate the difference between how VS handles .cs files verses .js files. Any help would be greatly appreciated.

1 Answers

Hope this works for you,

Tools -> Options -> Text Editor -> JavaScript/TypeScript -> Language Service:

Uncheck the "Enable the new JavaScript Language Service".

Close the javascript files, open them again. Formatting and intellisense should be working again.

Ref:

Related