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

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.

主站蜘蛛池模板: 昭平县| 兴业县| 江源县| 黄大仙区| 永登县| 许昌县| 若尔盖县| 西乡县| 大港区| 澄城县| 中超| 左权县| 和龙市| 扬中市| 界首市| 东辽县| 金湖县| 永州市| 辽宁省| 长海县| 延长县| 百色市| 临猗县| 宣汉县| 岳普湖县| 宜州市| 连山| 九江县| 平山县| 马公市| 怀化市| 镇康县| 罗源县| 鄢陵县| 丽江市| 长乐市| 峨眉山市| 本溪市| 上虞市| 汉川市| 鄂伦春自治旗|