簡體   English   中英

WebStorm代碼樣式模板-TypeScript

[英]WebStorm Code Style Templates - TypeScript

當前,基於WebStorm IDE中的TypeScript代碼樣式設置,Angular @Component裝飾器代碼的格式如下:

@Component({
               selector: 'my-component',
               templateUrl: 'my.component.html',
               styleUrls: ['my.component.scss']
           })
export class MyComponent implements OnInit {

我想要的是在執行自動格式化時將其格式化為:

@Component({
    selector: 'my-component',
    templateUrl: 'my.component.html',
    styleUrls: ['my.component.scss']
})
export class MyComponent implements OnInit {

但是,我找不到正確的設置。 我在WebStorm設置的“ Editor > Code Style > Typescript下的“ Tabs and Indents選項卡上具有以下設置:

在此處輸入圖片說明

感謝@jonrsharpe向我指出了正確的方向,我設法弄清楚了...

  1. 在WebStorm中,轉到“ 文件” > “設置” ,然后進入 編輯器” > “代碼樣式” >“ 打字稿”

  2. 單擊包裝和括號選項卡

  3. 確保未選中方法調用參數 > 對齊多行時對齊

在此處輸入圖片說明

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM