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

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.

主站蜘蛛池模板: 桐乡市| 陇西县| 克东县| 讷河市| 闻喜县| 湛江市| 融水| 高阳县| 衡山县| 楚雄市| 鄢陵县| 榆林市| 门源| 盘山县| 凌源市| 凤翔县| 横山县| 雅江县| 雷州市| 安阳县| 竹溪县| 茌平县| 茌平县| 双城市| 新闻| 高邑县| 蒲江县| 万荣县| 张家界市| 华容县| 蛟河市| 台中市| 苍梧县| 宁陕县| 浮梁县| 元氏县| 招远市| 太仓市| 千阳县| 赤城县| 清水县|