rDr4g0n/JsDebuggr

Error when trying to add a breakpoint

Closed this issue · 18 comments

When I try and add a break point (ST3) I get this error:

Traceback (most recent call last):
  File "/Applications/Sublime Text.app/Contents/MacOS/sublime_plugin.py", line 549, in run_
    return self.run(edit)
  File "/Users/scottdavis/Library/Application Support/Sublime Text 3/Packages/JsDebuggr/JsDebuggr.py", line 44, in run
    self.toggle_breakpoint(edit)
  File "/Users/scottdavis/Library/Application Support/Sublime Text 3/Packages/JsDebuggr/JsDebuggr.py", line 61, in toggle_breakpoint
    self.add_breakpoint(edit, viewId, lineNum)
  File "/Users/scottdavis/Library/Application Support/Sublime Text 3/Packages/JsDebuggr/JsDebuggr.py", line 97, in add_breakpoint
    breakpoint.add(self.view, edit)
  File "/Users/scottdavis/Library/Application Support/Sublime Text 3/Packages/JsDebuggr/JsDebuggr.py", line 221, in add
    view.add_regions(self.id, [line], self.scope, "circle", sublime.HIDDEN | sublime.PERSISTENT)
  File "/Applications/Sublime Text.app/Contents/MacOS/sublime.py", line 802, in add_regions
    sublime_api.view_add_regions(self.view_id, key, regions, scope, icon, flags)
TypeError: String required

Can you grab the latest and try again? I enabled all the console debugging stuff so I should be able to get a better idea of what's happening. Thanks!

Here's the error message after pulling the latest version of master:

adding this view to breakpoints
----------------
creating new breakpoint for line 64
adding breakpoint for line 64
Traceback (most recent call last):
  File "/Applications/Sublime Text.app/Contents/MacOS/sublime_plugin.py", line 549, in run_
    return self.run(edit)
  File "/Users/scottdavis/Library/Application Support/Sublime Text 3/Packages/JsDebuggr/JsDebuggr.py", line 44, in run
    self.toggle_breakpoint(edit)
  File "/Users/scottdavis/Library/Application Support/Sublime Text 3/Packages/JsDebuggr/JsDebuggr.py", line 61, in toggle_breakpoint
    self.add_breakpoint(edit, viewId, lineNum)
  File "/Users/scottdavis/Library/Application Support/Sublime Text 3/Packages/JsDebuggr/JsDebuggr.py", line 97, in add_breakpoint
    breakpoint.add(self.view, edit)
  File "/Users/scottdavis/Library/Application Support/Sublime Text 3/Packages/JsDebuggr/JsDebuggr.py", line 221, in add
    view.add_regions(self.id, [line], self.scope, "circle", sublime.HIDDEN | sublime.PERSISTENT)
  File "/Applications/Sublime Text.app/Contents/MacOS/sublime.py", line 802, in add_regions
    sublime_api.view_add_regions(self.view_id, key, regions, scope, icon, flags)
TypeError: String required

Hey, I did a COMPLETE rewrite of this plugin. Can ya give it a shot when you have a chance? Be sure to remove the old one first.

I just removed and re-cloned. Now I'm getting this error message when I try to add a breakpoint:

creating new BreakpointList
Traceback (most recent call last):
  File "/Applications/Sublime Text.app/Contents/MacOS/sublime_plugin.py", line 271, in on_modified
    callback.on_modified(v)
  File "/Users/scottdavis/Library/Application Support/Sublime Text 3/Packages/JsDebuggr/JsDebuggr.py", line 323, in on_modified
    if currNumLines != self.numLines[viewId]:
KeyError: '17'
Traceback (most recent call last):
  File "/Applications/Sublime Text.app/Contents/MacOS/sublime_plugin.py", line 271, in on_modified
    callback.on_modified(v)
  File "/Users/scottdavis/Library/Application Support/Sublime Text 3/Packages/JsDebuggr/JsDebuggr.py", line 323, in on_modified
    if currNumLines != self.numLines[viewId]:
KeyError: '17'
Traceback (most recent call last):
  File "/Applications/Sublime Text.app/Contents/MacOS/sublime_plugin.py", line 271, in on_modified
    callback.on_modified(v)
  File "/Users/scottdavis/Library/Application Support/Sublime Text 3/Packages/JsDebuggr/JsDebuggr.py", line 323, in on_modified
    if currNumLines != self.numLines[viewId]:
KeyError: '17'
Traceback (most recent call last):
  File "/Applications/Sublime Text.app/Contents/MacOS/sublime_plugin.py", line 271, in on_modified
    callback.on_modified(v)
  File "/Users/scottdavis/Library/Application Support/Sublime Text 3/Packages/JsDebuggr/JsDebuggr.py", line 323, in on_modified
    if currNumLines != self.numLines[viewId]:
KeyError: '17'
Traceback (most recent call last):
  File "/Applications/Sublime Text.app/Contents/MacOS/sublime_plugin.py", line 271, in on_modified
    callback.on_modified(v)
  File "/Users/scottdavis/Library/Application Support/Sublime Text 3/Packages/JsDebuggr/JsDebuggr.py", line 323, in on_modified
    if currNumLines != self.numLines[viewId]:
KeyError: '17'
creating new breakpoint for line 51
creating new BreakpointList
Traceback (most recent call last):
  File "/Applications/Sublime Text.app/Contents/MacOS/sublime_plugin.py", line 271, in on_modified
    callback.on_modified(v)
  File "/Users/scottdavis/Library/Application Support/Sublime Text 3/Packages/JsDebuggr/JsDebuggr.py", line 323, in on_modified
    if currNumLines != self.numLines[viewId]:
KeyError: '18'
Traceback (most recent call last):
  File "/Applications/Sublime Text.app/Contents/MacOS/sublime_plugin.py", line 271, in on_modified
    callback.on_modified(v)
  File "/Users/scottdavis/Library/Application Support/Sublime Text 3/Packages/JsDebuggr/JsDebuggr.py", line 323, in on_modified
    if currNumLines != self.numLines[viewId]:
KeyError: '18'
Traceback (most recent call last):
  File "/Applications/Sublime Text.app/Contents/MacOS/sublime_plugin.py", line 271, in on_modified
    callback.on_modified(v)
  File "/Users/scottdavis/Library/Application Support/Sublime Text 3/Packages/JsDebuggr/JsDebuggr.py", line 323, in on_modified
    if currNumLines != self.numLines[viewId]:
KeyError: '18'
Traceback (most recent call last):
  File "/Applications/Sublime Text.app/Contents/MacOS/sublime_plugin.py", line 271, in on_modified
    callback.on_modified(v)
  File "/Users/scottdavis/Library/Application Support/Sublime Text 3/Packages/JsDebuggr/JsDebuggr.py", line 323, in on_modified
    if currNumLines != self.numLines[viewId]:
KeyError: '18'
creating new BreakpointList
Traceback (most recent call last):
  File "/Applications/Sublime Text.app/Contents/MacOS/sublime_plugin.py", line 271, in on_modified
    callback.on_modified(v)
  File "/Users/scottdavis/Library/Application Support/Sublime Text 3/Packages/JsDebuggr/JsDebuggr.py", line 323, in on_modified
    if currNumLines != self.numLines[viewId]:
KeyError: '10'
Traceback (most recent call last):
  File "/Applications/Sublime Text.app/Contents/MacOS/sublime_plugin.py", line 271, in on_modified
    callback.on_modified(v)
  File "/Users/scottdavis/Library/Application Support/Sublime Text 3/Packages/JsDebuggr/JsDebuggr.py", line 323, in on_modified
    if currNumLines != self.numLines[viewId]:
KeyError: '10'
Traceback (most recent call last):
  File "/Applications/Sublime Text.app/Contents/MacOS/sublime_plugin.py", line 271, in on_modified
    callback.on_modified(v)
  File "/Users/scottdavis/Library/Application Support/Sublime Text 3/Packages/JsDebuggr/JsDebuggr.py", line 323, in on_modified
    if currNumLines != self.numLines[viewId]:
KeyError: '10'
Traceback (most recent call last):
  File "/Applications/Sublime Text.app/Contents/MacOS/sublime_plugin.py", line 271, in on_modified
    callback.on_modified(v)
  File "/Users/scottdavis/Library/Application Support/Sublime Text 3/Packages/JsDebuggr/JsDebuggr.py", line 323, in on_modified
    if currNumLines != self.numLines[viewId]:
KeyError: '10'
Traceback (most recent call last):
  File "/Applications/Sublime Text.app/Contents/MacOS/sublime_plugin.py", line 271, in on_modified
    callback.on_modified(v)
  File "/Users/scottdavis/Library/Application Support/Sublime Text 3/Packages/JsDebuggr/JsDebuggr.py", line 323, in on_modified
    if currNumLines != self.numLines[viewId]:
KeyError: '10'
Traceback (most recent call last):
  File "/Applications/Sublime Text.app/Contents/MacOS/sublime_plugin.py", line 271, in on_modified
    callback.on_modified(v)
  File "/Users/scottdavis/Library/Application Support/Sublime Text 3/Packages/JsDebuggr/JsDebuggr.py", line 323, in on_modified
    if currNumLines != self.numLines[viewId]:
KeyError: '10'
Traceback (most recent call last):
  File "/Applications/Sublime Text.app/Contents/MacOS/sublime_plugin.py", line 271, in on_modified
    callback.on_modified(v)
  File "/Users/scottdavis/Library/Application Support/Sublime Text 3/Packages/JsDebuggr/JsDebuggr.py", line 323, in on_modified
    if currNumLines != self.numLines[viewId]:
KeyError: '10'
Traceback (most recent call last):
  File "/Applications/Sublime Text.app/Contents/MacOS/sublime_plugin.py", line 271, in on_modified
    callback.on_modified(v)
  File "/Users/scottdavis/Library/Application Support/Sublime Text 3/Packages/JsDebuggr/JsDebuggr.py", line 323, in on_modified
    if currNumLines != self.numLines[viewId]:
KeyError: '10'

It does add the orange dot on the margin: screen shot

Here's the entire file that I'm trying to add the breakpoint to: https://gist.github.com/6341479

Can you try closing the file and then reopening? The code that sets up the document to track breakpoints only triggers on document load. It looks like that code may not have triggered yet.

OK. I closed the file and re-opened and now there are no error messages in the console. However, it's still not adding breakpoints. I see the orange dot in the margin, but when I view the code in the browser, there's no debugger statement. Here's my console output:

Not tracking document because it is not of the correct type.
creating new BreakpointList
setting numlines to 81
found 0 exiting debugger statements
creating new breakpoint for line 1
creating new breakpoint for line 51
removing breakpoint for line 1
removing breakpoint for line 51
creating new breakpoint for line 51
Writing file /Users/scottdavis/Documents/Projects/Wildlife/dataentry/src/app/App.js with encoding UTF-8 (atomic)
Reloading keys...

Here's the code in sublime: ss

and here's the same code in Chrome dev tools: ss

Perhaps I have a conflicting package installed? It's a shame that I can't get this to work because I would love this functionality. I know python, but don't have any experience in developing sublime packages. Is there any way that I can step through your plugin file and see what's going on?

Something also that's interesting, when I close the file and re-open it, I loose the orange dot in the margin.

It looks like the plugin isn't loading completely. I have the same problem you're describing if I close sublime text, then reopen it and try to use the plugin. However, if I open the .py file for the plugin and save it, it forces the plugin to reload in sublime text, and everything works normally.

The .py file is (probably) at %HOMEPATH%\AppData\Roaming\Sublime Text 3\Packages\JsDebuggr\JsDebuggr.py if you want to try to debug it.

just pushed a new version that gets rid of some of the errors. maybe that'll magically fix the other issues.

Nope. Didn't see any changes. Bummer.

On Mon, Aug 26, 2013 at 8:44 AM, rDr4g0n notifications@github.com wrote:

just pushed a new version that gets rid of some of the errors. maybe
that'll magically fix the other issues.


Reply to this email directly or view it on GitHubhttps://github.com//issues/3#issuecomment-23267198
.

ok, I'll give it another go-over a little later on. thanks for the help with this. :)

New build went up that fixed a bug with tracking documents by type correctly. In your last log dump I saw Not tracking document because it is not of the correct type.. The way the tracking works is that it asks sublime for the open file's filename and then splits does file_name.split(".")[-1]. That should give me the extension of the file. If it isn't one of the trackable file extensions (right now they are hardcoded: .js, .html, and .htm) then it ignores the document. Let me know if you are seeing that "not tracking" message even if you're opening a .js file.

Got yet another build up if you want to take a look. I have tested it on st3 on 2 different machines and everything is working for me. Maybe try closing sublime text completely, then opening it and then opening a .js file.

It's working now! Kind of. The only problem now is that it's marking my doc
as dirty even after I hit save if there are any break points in the doc.
Maybe that's intended? Either way, I'll keep playing with it.

Thanks!

On Tue, Aug 27, 2013 at 8:12 AM, rDr4g0n notifications@github.com wrote:

Got yet another build up if you want to take a look. I have tested it on
st3 on 2 different machines and everything is working for me. Maybe try
closing sublime text completely, then opening it and then opening a .js
file.


Reply to this email directly or view it on GitHubhttps://github.com//issues/3#issuecomment-23339314
.

Yay! yeah that is known behavior. When you save the doc, all the debugger statements are added, then after save is complete, theyre all removed. This marks the view as dirty. I cant find a way in sublime text's plugin api docs to manually mark it as clean, so that might have to hang around until i come up with a workaround.

I know for sure that there are some bugs related to how breakpoints are shifted up and down when lines are added and removed, if you run into those, add the details to an existing issue for that: #4

thanks for all the help with testing this so far :)

OK. That makes sense. Yes, I'll keep an eye on things. I would love to
contribute.

On Tue, Aug 27, 2013 at 10:47 AM, rDr4g0n notifications@github.com wrote:

Yay! yeah that is known behavior. When you save the doc, all the debugger
statements are added, then after save is complete, theyre all removed. This
marks the view as dirty. I cant find a way in sublime text's plugin api
docs to manually mark it as clean, so that might have to hang around until
i come up with a workaround.

I know for sure that there are some bugs related to how breakpoints are
shifted up and down when lines are added and removed, if you run into
those, add the details to an existing issue for that: #4#4

thanks for all the help with testing this so far :)


Reply to this email directly or view it on GitHubhttps://github.com//issues/3#issuecomment-23351829
.

It appears that in order to use the plugin, JsDebuggr.py has to be re-saved each time SubLime Text is re-opened. I'm on OSX using Sublime Text3

can you check the console for any errors or log messages from JsDebuggr and post them as a new issue so that I can see what's happening? I have a feeling I know which problem you're referring to.