From the course: Visual Studio Code Productivity Tips

Unlock this course with a free trial

Join today to access over 24,800 courses taught by industry experts.

Tidy up code layout with Format Document

Tidy up code layout with Format Document

From the course: Visual Studio Code Productivity Tips

Tidy up code layout with Format Document

- [Instructor] Check out the code in this example in FormatCode.js. As we look through the code, we can find many layout and readability issues. For example, on line three, there's an extra space between zero and the semicolon. Line five is indented differently than the rest of the document. Line 11 has some extra spaces. Look at line 16. The curly brace is on a separate line from the function declaration, and that's inconsistent with the function on line one, where the curly brace is on the same line. I can make all these changes manually, but there are formatting tools available that do a better job and are faster too. Let's go take a look at the Settings before I do any formatting. I'll click on Settings, tabs already open. What we're looking at here is I searched for the word format and at the top, I can see what's called the Default Formatter. You see it says defines the default formatter, which takes precedents over all other formatter settings. Currently set to None. That means…

Contents