Skip to content

Commit

Permalink
Add pause on exception support
Browse files Browse the repository at this point in the history
Fix path and file name issues fix #26
  • Loading branch information
sokolovstas committed Mar 21, 2013
1 parent b23db88 commit 218e2d3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
9 changes: 5 additions & 4 deletions swi.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,7 @@ def connected(self):
protocol.subscribe(wip.Debugger.resumed(), self.resumed)
protocol.send(wip.Debugger.enable())
protocol.send(wip.Console.enable())
protocol.send(wip.Debugger.setPauseOnExceptions(get_setting('pause_on_exceptions')))
protocol.send(wip.Debugger.canSetScriptSource(), self.canSetScriptSource)
if reload_on_start:
protocol.send(wip.Network.clearBrowserCache())
Expand Down Expand Up @@ -311,9 +312,9 @@ def scriptParsed(self, data, notification):
while len(url_parts) > 0:
for folder in project_folders:
if sublime.platform() == "windows":
files = glob.glob(folder + "\\*\\" + "\\".join(url_parts))
files = glob.glob(folder + "\\*\\" + "\\".join(url_parts))+glob.glob(folder + "\\" + "\\".join(url_parts))
else:
files = glob.glob(folder + "/*/" + "/".join(url_parts))
files = glob.glob(folder + "/*/" + "/".join(url_parts))+glob.glob(folder + "/" + "/".join(url_parts))

if len(files) > 0 and files[0] != '':
file_name = files[0]
Expand Down Expand Up @@ -733,9 +734,9 @@ def on_post_save(self, view):
print view.file_name().find('.js')
if protocol and reload_on_save:
protocol.send(wip.Network.clearBrowserCache())
if view.file_name().find('.css') > 0 or view.file_name().find('.less') > 0 or view.file_name().find('.sass') > 0 or view.file_name().find('.scss') > 0:
if view.file_name().endswith('.css') > 0 or view.file_name().endswith('.less') > 0 or view.file_name().endswith('.sass') > 0 or view.file_name().endswith('.scss') > 0:
protocol.send(wip.Runtime.evaluate("var files = document.getElementsByTagName('link');var links = [];for (var a = 0, l = files.length; a < l; a++) {var elem = files[a];var rel = elem.rel;if (typeof rel != 'string' || rel.length === 0 || rel === 'stylesheet') {links.push({'elem': elem,'href': elem.getAttribute('href').split('?')[0],'last': false});}}for ( a = 0, l = links.length; a < l; a++) {var link = links[a];link.elem.setAttribute('href', (link.href + '?x=' + Math.random()));}"))
elif view.file_name().find('.js') > 0:
elif view.file_name().endswith('.js') > 0:
scriptId = find_script(view.file_name())
if scriptId and set_script_source:
scriptSource = view.substr(sublime.Region(0, view.size()))
Expand Down
1 change: 1 addition & 0 deletions swi.sublime-settings
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,6 @@
"reload_on_save": true,
"set_script_source": false,
"open_stack_current_in_new_tab": false,
"pause_on_exceptions": "uncaught",
"breaks": {}
}

0 comments on commit 218e2d3

Please sign in to comment.