Skip to content

Commit 551335b

Browse files
committed
Add support for sublime 2
1 parent 860f266 commit 551335b

File tree

1 file changed

+17
-6
lines changed

1 file changed

+17
-6
lines changed

typescript/commands/build.py

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import sublime_plugin
22
import sublime
33
import os
4+
from ..libs.global_vars import IS_ST2
45

56

67
class TypescriptBuildCommand(sublime_plugin.WindowCommand):
@@ -9,8 +10,9 @@ def run(self):
910
directory = os.path.dirname(file_name)
1011
if "tsconfig.json" in os.listdir(directory):
1112
self.window.run_command("exec", {
12-
"shell_cmd": "tsc",
13-
"file_regex": "^(.+?)\\((\\d+),(\\d+)\\): (.+)$"
13+
"cmd": "tsc",
14+
"file_regex": "^(.+?)\\((\\d+),(\\d+)\\): (.+)$",
15+
"shell": True
1416
})
1517
else:
1618
sublime.active_window().show_input_panel(
@@ -23,7 +25,16 @@ def run(self):
2325

2426
def compile_inferred_project(self, params=""):
2527
file_name = self.window.active_view().file_name()
26-
self.window.run_command("exec", {
27-
"shell_cmd": "tsc {0} {1}".format(file_name, params),
28-
"file_regex": "^(.+?)\\((\\d+),(\\d+)\\): (.+)$"
29-
})
28+
if not IS_ST2:
29+
cmd = "tsc {0} {1}".format(file_name, params)
30+
self.window.run_command("exec", {
31+
"shell_cmd": cmd,
32+
"file_regex": "^(.+?)\\((\\d+),(\\d+)\\): (.+)$"
33+
})
34+
else:
35+
cmd = "tsc {0} {1}".format(file_name, params)
36+
self.window.run_command("exec", {
37+
"cmd": [cmd],
38+
"file_regex": "^(.+?)\\((\\d+),(\\d+)\\): (.+)$",
39+
"shell": True
40+
})

0 commit comments

Comments
 (0)