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
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
-
-
-
Explore and navigate code: Go to Definition3m 24s
-
(Locked)
Explore and navigate code: Find All References2m 21s
-
(Locked)
Explore and navigate code: Peek Definition1m 26s
-
(Locked)
Refactor the code5m
-
(Locked)
Tidy up code layout with Format Document4m 18s
-
(Locked)
Create custom keybindings for commands2m 18s
-
(Locked)
Fun with brackets and braces2m 49s
-
(Locked)
Simple technique to move code blocks52s
-
(Locked)
Use Emmet notation to quickly add boilerplate text8m 19s
-
(Locked)
Use font ligatures to add symbols to your code3m 31s
-
(Locked)
Better document tabs5m 10s
-
(Locked)
Declutter the UI2m 16s
-
(Locked)
Work with files3m 12s
-
(Locked)
Expand selection with keyboard shortcuts2m 14s
-
-