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

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.

主站蜘蛛池模板: 绵阳市| 肥城市| 乐都县| 琼中| 佛教| 鄂尔多斯市| 静海县| 监利县| 临西县| 来凤县| 长子县| 三亚市| 唐山市| 扎兰屯市| 巫山县| 台南市| 大悟县| 大英县| 探索| 苏尼特右旗| 梅州市| 红桥区| 宁武县| 安阳市| 云阳县| 德江县| 广饶县| 石屏县| 健康| 玛纳斯县| 铁岭县| 云梦县| 民权县| 靖西县| 翁源县| 达拉特旗| 东港市| 辽阳县| 霸州市| 岫岩| 徐州市|