Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions Main.sublime-menu
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"children":
[
{
"caption": "Clear All Python Breakpoints",
"caption": "Clear All PythonBreakpoints",
"command": "clear_all_breakpoints",
"mnemonic": "C"
}
Expand All @@ -41,13 +41,13 @@
"children":
[
{
"caption": "Python Breakpoints",
"caption": "PythonBreakpoints",
"children":
[
{
"caption": "Settings – Default",
"command": "open_file",
"args": {"file": "${packages}/Python Breakpoints/PythonBreakpoints.sublime-settings"}
"args": {"file": "${packages}/PythonBreakpoints/PythonBreakpoints.sublime-settings"}
},
{
"caption": "Settings – User",
Expand All @@ -59,23 +59,23 @@
"caption": "Key Bindings – Default",
"command": "open_file",
"args": {
"file": "${packages}/Python Breakpoints/Default (OSX).sublime-keymap",
"file": "${packages}/PythonBreakpoints/Default (OSX).sublime-keymap",
"platform": "OSX"
}
},
{
"caption": "Key Bindings – Default",
"command": "open_file",
"args": {
"file": "${packages}/Python Breakpoints/Default (Linux).sublime-keymap",
"file": "${packages}/PythonBreakpoints/Default (Linux).sublime-keymap",
"platform": "Linux"
}
},
{
"caption": "Key Bindings – Default",
"command": "open_file",
"args": {
"file": "${packages}/Python Breakpoints/Default (Windows).sublime-keymap",
"file": "${packages}/PythonBreakpoints/Default (Windows).sublime-keymap",
"platform": "Windows"
}
},
Expand Down
11 changes: 6 additions & 5 deletions PythonBreakpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ def plugin_loaded():
# Constants #
#############

bp_regex = r"^[\t ]*import [\w.; ]+set_trace\(\) # breakpoint ([a-f0-9]{8})([a-z]?) //"
bp_re = re.compile(bp_regex, re.DOTALL)
bp_regex = r"^[\t ].*# breakpoint ([a-f0-9]{8})([a-z]?) //"
bp_re = re.compile(bp_regex, re.DOTALL)

EXPR_PRE = ['class', 'def', 'if', 'for', 'try', 'while', 'with']
EXPR_PST = ['elif', 'else', 'except', 'finally']
Expand Down Expand Up @@ -86,9 +86,10 @@ def as_string(self, indent):
"""
format breakpoint string
"""
debugger = settings.get('debugger', 'pdb')
return "{indent}import {dbg}; {dbg}.set_trace() # breakpoint {uid}{mark} //\n".format(
indent=' ' * indent, dbg=debugger, uid=self.uid, mark='x' if self.in_block else '')
custom_string = settings.get('breakpoint_string', 'import pdb; pdb.set_trace()')
return "{indent}{breakpoint_string} # breakpoint {uid}{mark} //\n".format(
indent=' ' * indent, breakpoint_string=custom_string,
uid=self.uid, mark='x' if self.in_block else '')

def highlight(self, view, rg):
"""
Expand Down
8 changes: 6 additions & 2 deletions PythonBreakpoints.sublime-settings
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
{
// preferred debugger (pdb, ipdb, pudb,..) - must support set_trace() call
"debugger": "pdb",
// The string inserted in breakpoint locations. You can use your preferred
// debugger (pdb, ipdb, pudb,..).
// The 'if' statement is to ease conditional breakpoints easier.
// Other examples:
// "if True: import ipdb; ipdb.set_trace(context=10)"
"breakpoint_string": "if True: import pdb; pdb.set_trace()",

// "auto" (read from global settings), or a positive integer
"tab_size": "auto",
Expand Down