rDr4g0n/JsDebuggr

This plugin doesn't seem to be working

Opened this issue · 1 comments

I installed this plugin today and cannot seem to set a breakpoint (or perform any other functionality ascribed to this plugin). I have a feeling this is probably related to something in my environment but wanted to post here to see if anyone has any thoughts on this.

Versions & Stuff

  • Sublime Text: Version 3.0, Build 3170
  • OS: Mac OS High Sierra 10.13.4 (17E202)
  • Node: v8.10.0

Errors?

Yup ... this (or some variation of it) repeats in my console.

Traceback (most recent call last):
  File "/Applications/Sublime Text.app/Contents/MacOS/sublime_plugin.py", line 462, in run_callback
    expr()
  File "/Applications/Sublime Text.app/Contents/MacOS/sublime_plugin.py", line 501, in <lambda>
    run_callback('on_load', callback, lambda: callback.on_load(v))
  File "/Users/zacharyabresch/Library/Application Support/Sublime Text 3/Installed Packages/JsDebuggr.sublime-package/jsdebuggr.py", line 210, in on_load
    syntax = get_current_syntax(view, settings)
  File "/Users/zacharyabresch/Library/Application Support/Sublime Text 3/Installed Packages/JsDebuggr.sublime-package/utils.py", line 26, in get_current_syntax
    for l in languages:
TypeError: 'NoneType' object is not iterable

Also, the contextual menu is entirely disabled (i.e. grayed out) as seen here:

2018-05-10 at 10 39 am

Troubleshooting

  • I've restarted Sublime multiple times (from Applications as well as using subl from iTerm) with no change
  • I've attempted to use the keyboard shortcuts but ... can't tell if they did anything at all
  • I've closed and re-opened a few different files in my project, from simple to complex, with no change in functionality

Now, the other devs on my team are all:

Hey, VSCode lets me set breakpoints just by clicking

and I'm all:

Oh, I bet Sublime can do that too. See, a plugin!

Please help me defend Sublime Text from invaders!! Seriously, any ideas or thoughts you might have on this would be greatly appreciated.

Thanks for building this!

Are you using Babel or something which changes file syntax?

The plugin is using this configuration

{
	"languages": [
		{
			"name": "javascript",
			"debugger": "",
			"debuggerRegex": ";'JSDBG';if\\((.*)\\)debugger; ",
			"enabled": "true",
			"disabled": "false",
			"scopes": [],
			"syntaxes": ["JavaScript.sublime-syntax"]
		},{
			"name": "html",
			"debugger": "",
			"debuggerRegex": ";'JSDBG';if\\((.*)\\)debugger; ",
			"enabled": "true",
			"disabled": "false",
			"scopes": ["source.js.embedded.html"],
			"syntaxes": ["HTML.sublime-syntax"]
		}
	]
}

I had the babel plugin which change the file syntax to JavaScript (Babel).sublime-syntax

I tried an ugly fix with this on the utils.py function

def get_current_syntax(view, settings):
    # TODO - this seems like its just waitin to asplode
    currSyntax = view.settings().get("syntax").split("/")[-1]
    debug("current syntax is %s" % currSyntax)
    languages = settings.get("languages")
    if currSyntax == "JavaScript.sublime-syntax" or currSyntax == "JavaScript (Babel).sublime-syntax"
        return languages[0]
    
    for l in languages:
        for s in l["syntaxes"]:
           if s == currSyntax:
                return l
    
    return None

If you need some trick fast try this, it seems to work.