2016-02-25 39 views
4

我正在使用angularScript 2打字稿,並在編寫內聯模板時使用反引號。Typescript反斜槓語法突出顯示

但內部的內容沒有突出顯示,它保持相同的顏色,有時難以調試。

@Component({ 
    selector: "my-template-driven", 
    template: ` 
     <h2>Sign-up Form</h2> 
     <form (ngSubmit)="onSubmit(f)" #f="ngForm"> 
     <section> 
      <label for="email">Email</label> 
      <input type="email" id="email" ngControl="email" #email="ngForm"> 
      <span class="validation-error" required *ngIf="!email.valid">Not Valid</span> 
     </section> 
     <section> 
      <label for="password">Password</label> 
      <input type="password" id="password" ngControl="password" #password="ngForm"> 
      <span class="validation-error" required *ngIf="!password.valid">Not Valid</span> 
     </section> 
     <section> 
      <label for="confirm-password">Confirm Password</label> 
      <input type="confirm-password" id="confirm-password" ngControl="confirm-password" #confirmPassword = "ngForm"> 
      <span class="validation-error" required *ngIf="!confirmPassword.valid">Not Valid</span> 
     </section> 
     <button type="submit">Submit</button> 
     </form> 
    ` 

}) 

有沒有解決方法呢?還有什麼IDE支持這個?

+0

我不知道原子的插件。但'webstorm'確實有這個功能。您甚至可以從模板內跳轉到組件,方法和屬性 – PierreDuc

+0

我正在使用WebStorm 11.0.3,它具有您正在查找的功能。 –

+0

https://www.jetbrains.com/help/phpstorm/2016.1/using-language-injections.html和https://blog.jetbrains.com/webstorm/tag/angular2/ –

回答

0

atom-typescript有一個open issue增加對此的支持,不幸的是,它看起來不像作者自3月以來已經取得了進展。

然而,另一名開發人員想出了一個fork of the atom-typescript repository這確實增加了語法反引號內高亮的支持,您可以通過運行命令行安裝:

apm install atom-typescript-zh-backticks 

您也可以從Install找到它標籤內SettingsCtrl鍵 - 逗號

UPDATE:現在其官方原子打字稿包的一部分。