Skip to content

Commit

Permalink
Reformat stack entry output to improve distinction between file/line …
Browse files Browse the repository at this point in the history
…and function.
  • Loading branch information
martomo committed Jan 6, 2018
1 parent db341c7 commit bb07894
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions Xdebug.tmLanguage
Original file line number Diff line number Diff line change
Expand Up @@ -90,16 +90,16 @@
<key>3</key>
<dict>
<key>name</key>
<string>string.quoted.xdebug.stack.where</string>
<string>string.quoted.xdebug.stack.lineno</string>
</dict>
<key>4</key>
<dict>
<key>name</key>
<string>variable.parameter.xdebug.stack.lineno</string>
<string>variable.parameter.xdebug.stack.where</string>
</dict>
</dict>
<key>match</key>
<string>^(\[\d+\])\s*(.*)(\..*)(\s*:.*\d+)</string>
<string>^(\[\d+\])\s(.*)(:\d+),\s(.*\(\))</string>
<key>name</key>
<string>meta.xdebug.stack.line</string>
</dict>
Expand All @@ -118,7 +118,7 @@
</dict>
</dict>
<key>match</key>
<string>^(\[.*?\])\s*(.*)</string>
<string>^(\[\D+\])\s(.*)</string>
<key>name</key>
<string>meta.xdebug.stack.exception</string>
</dict>
Expand Down
6 changes: 3 additions & 3 deletions xdebug/view.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,15 +167,15 @@ def generate_stack_output(response):
stack_line = child.get(dbgp.STACK_LINENO, 0)
stack_where = child.get(dbgp.STACK_WHERE, '{unknown}')
# Append values
values += H.unicode_string('[{level}] {filename}.{where}:{lineno}\n'
values += H.unicode_string('[{level}] {filename}:{lineno}, {where}()\n'
.format(level=stack_level, type=stack_type, where=stack_where, lineno=stack_line, filename=stack_file))
has_output = True
except:
pass

# When no stack use values from exception
if not has_output and S.BREAKPOINT_EXCEPTION:
values += H.unicode_string('[{level}] {filename}.{where}:{lineno}\n'
values += H.unicode_string('[{level}] {filename}:{lineno}, {where}()\n'
.format(level=0, where='{unknown}', lineno=S.BREAKPOINT_EXCEPTION['lineno'], filename=S.BREAKPOINT_EXCEPTION['filename']))

return values
Expand Down Expand Up @@ -871,7 +871,7 @@ def toggle_stack(view):
if point.size() > 3 and sublime.score_selector(view.scope_name(point.a), 'meta.xdebug.stack.line'):
# Get fileuri and line number from selected line in view
line = view.substr(view.line(point))
pattern = re.compile('^(\[\d+\])\s*(?P<fileuri>.*)(\..*)(\s*:.*?(?P<lineno>\d+))\s*(\((.*?):.*\)|$)')
pattern = re.compile('^\[\d+\]\s(?P<fileuri>.*):(?P<lineno>\d+)')
match = pattern.match(line)
# Show file when it's a valid fileuri
if match and match.group('fileuri'):
Expand Down

0 comments on commit bb07894

Please sign in to comment.