官术网_书友最值得收藏!

Code formatting

In this section, we are going to install another extension in Visual Studio Code, called Prettier, which will automatically format our code. As well as putting a stop to all the ongoing debates over styles, it will help us adhere to some of the TSLint rules:

  1. Let's open Visual Studio Code, go to the Extensions area, and type prettier in the search box. The extension is called Prettier - Code formatter and was published by Esben Petersen:

  1. We need to click the Install option to install the extension.
  2. After it has been installed, we'll need to reload Visual Studio Code for the extension to become enabled.
  3. The last step is to make sure the Format on Save option is ticked in User Settings. Press Ctrl +, (comma) to open the settings screen and type Format On Save in the search box to find the setting. If the setting isn't ticked, then tick it:

Now that this extension is installed, when we save our TypeScript code, it will automatically be formatted nicely for us.

主站蜘蛛池模板: 宁波市| 陕西省| 东明县| 昔阳县| 太和县| 西林县| 黄梅县| 清新县| 正安县| 昭觉县| 阳春市| 介休市| 榕江县| 大悟县| 濮阳市| 靖宇县| 务川| 望谟县| 江永县| 西城区| 加查县| 广州市| 沛县| 梁河县| 卓资县| 余江县| 横峰县| 达孜县| 泽普县| 高碑店市| 长沙县| 岑溪市| 来宾市| 秦安县| 新绛县| 武山县| 荔波县| 宜川县| 黄大仙区| 西藏| 比如县|