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

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.

主站蜘蛛池模板: 繁峙县| 新宾| 南汇区| 丰城市| 奉新县| 且末县| 卢氏县| 含山县| 巨鹿县| 江孜县| 新化县| 汝阳县| 贵德县| 尚志市| 南召县| 理塘县| 吉木乃县| 喀喇| 容城县| 白山市| 武穴市| 镇宁| 大冶市| 颍上县| 新乡市| 井研县| 普洱| 景泰县| 都安| 黔江区| 新兴县| 延津县| 晋州市| 汽车| 正定县| 凭祥市| 西华县| 格尔木市| 于田县| 雅江县| 阳春市|