2012-10-08 42 views
8

我正在寻找为TypeScript在Sublime Text中配置构建系统。我目前使用如何为TypeScript配置Sublime构建系统

...

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

我还想设置“file_regex”属性处理错误信息。

任何人都知道该怎么设置?

回答

12

在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创建的崇高构建系统。测试并按预期工作。然而,你需要在Windows环境tsc.cmd路径,否则你应该在下面的cmd部分定义根的打字稿命令:

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

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

如果你不断收到这样的错误?''[Errno 2]没有这样的文件或目录''' – Diogenes

+0

@Diogenes那么你可能使用ST3,应该使用“shell_cmd”而不是“cmd” – svallory

1

有两个版本了。这one,或这one。通过参考这个document来创建你自己的是很容易的。

相关问题