如何为 TypeScript 配置 Sublime 构建系统 [英] How to configure a Sublime Build System for TypeScript

查看:23
本文介绍了如何为 TypeScript 配置 Sublime 构建系统的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望在 Sublime Text 中为 TypeScript 配置一个构建系统.

I'm looking to configure a Build System in Sublime Text for TypeScript.

我目前正在使用...

{
  "cmd": ["tsc", "$file"],
  "selector": "source.ts"
}

我还想设置file_regex"属性来处理错误消息.

I'd also like to set the 'file_regex' property to handle error messages.

有人知道怎么设置吗?

推荐答案

在 OS-X 上使用:

Use this on OS-X:

{
    "cmd": ["tsc","$file"],
    "file_regex": "(.*\\.ts?)\\s\\(([0-9]+)\\,([0-9]+)\\)\\:\\s(...*?)$",
    "selector": "source.ts",
    "osx": {
       "path": "/usr/local/bin:/opt/local/bin"
    }
}

这是为 Windows 创建的 Sublime Build System.经测试并按预期工作.但是你需要在 windows 环境中包含 tsc.cmd 路径,否则你应该在下面的 cmd 部分定义 Typescript 命令的根:

Here is the Sublime Build System created for Windows. Tested and working as expected. However you need to include tsc.cmd path in the windows environment, otherwise you should define the root to the Typescript command in the cmd section below:

{
    "cmd": ["tsc","$file"],
    "file_regex": "(.*\\.ts?)\\s\\(([0-9]+)\\,([0-9]+)\\)\\:\\s(...*?)$",
    "selector": "source.ts",

    "windows": {
        "cmd": ["tsc.cmd", "$file"]
    }
}

这篇关于如何为 TypeScript 配置 Sublime 构建系统的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆