首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Typescript backticks语法突出显示

Typescript backticks语法突出显示
EN

Stack Overflow用户
提问于 2016-02-25 20:58:04
回答 1查看 1.4K关注 0票数 3

我使用的是angular 2和typescript,当你写一个内联模板时,你会用到反引号。

但是里面的内容没有高亮显示,它保持相同的颜色,这使得调试有时很困难。

代码语言:javascript
复制
@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?

EN

回答 1

Stack Overflow用户

发布于 2018-06-07 10:03:55

Nikolay Yakimov告诉我,由于atom-typescript没有资源来支持自己的语法分支,因此从v12开始不再支持语法突出显示。

看起来atom-typescript-zh-backticks也不再可用了。

虽然我喜欢v12中的一些新特性,但我觉得失去语法格式化的代价太大了。

atom-typescript仍然维护一个legacy分支,该分支具有反引号语法突出显示。要安装它,您需要执行以下操作:

从atom中的包管理器中卸载atom-typescript。然后:

代码语言:javascript
复制
cd ~/.atom/packages
git clone -b legacy https://github.com/TypeStrong/atom-typescript.git
cd atom-typescript-legacy
npm install

重新启动atom并在包管理器中检查atom-typescript。更有可能的是,您需要重新构建它并重新启动atom。

希望在不久的将来,有人会提出一种不依赖于遗留包的解决方案。但在此之前,这应该是可行的。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/35628008

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档