-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathnodejs_debug.py
44 lines (31 loc) · 1.03 KB
/
nodejs_debug.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
from subprocess import Popen
import re
import sublime, sublime_plugin
import webbrowser
import os
import sys
SETTINGS_FILE = "nodejs_debug.sublime-settings"
if sys.version_info >= (3,):
installed_dir, _ = __name__.split('.')
else:
installed_dir = os.path.basename(os.getcwd())
def _get_startupinfo():
PLATFORM_IS_WINDOWS = (sublime.platform() == 'windows')
if PLATFORM_IS_WINDOWS:
info = subprocess.STARTUPINFO()
info.dwFlags |= subprocess.STARTF_USESHOWWINDOW
info.wShowWindow = subprocess.SW_HIDE
return info
return None
class NodejsDebugCommand(sublime_plugin.TextCommand):
def run(self, edit):
sublime.set_timeout(self.launch, 100)
def launch(self):
window = sublime.active_window()
window.run_command('save')
regx = re.compile(" ")
cmd = "node-debug";
if sublime.platform() == "windows":
cmd += ".cmd";
subprocess.Popen([cmd,'--nodejs','--harmony','--web-port=9901',regx.sub("\ ",self.view.file_name())],
startupinfo=_get_startupinfo())