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

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.

主站蜘蛛池模板: 桐乡市| 海盐县| 巴里| 郑州市| 农安县| 英山县| 南宁市| 芦溪县| 祥云县| 江达县| 金堂县| 全南县| 石林| 大关县| 建始县| 怀柔区| 金湖县| 武乡县| 清远市| 苏尼特右旗| 平度市| 龙南县| 贡嘎县| 宣恩县| 喀什市| 红原县| 云梦县| 城步| 阳原县| 中西区| 象山县| 景德镇市| 鄄城县| 宜阳县| 光泽县| 恩施市| 雅江县| 醴陵市| 宁化县| 观塘区| 望江县|