rDr4g0n / JsDebuggr

Add, remove, enable, and disable breakpoints in javascript from the comfort of Sublime Text :D
147 stars 5 forks source link

This plugin doesn't seem to be working #33

Open zacharyabresch opened 6 years ago

zacharyabresch commented 6 years ago

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

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

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!

fabio0 commented 6 years ago

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.