I was a little bit bitten by the upgrade suddenly no longer running old extensions. I now wanted update the plugins I wrote and was looking for means of debugging since it apparently is not as straight forward. I’m no pro dev.
I tried to follow the debugging guide but it is not complete. You write one should just start the debug editor and start debugging. But how can I start it? Where can I open my extensions in this editor and set breakpoints?
I cannot invoke extensions with the regular shortcut. How can I then run the extensions to debug them once I managed to set the breakpoints?
Thanks a lot.
One thing that I sometimes do is create a temporary keybinding (those should work in debugger) to trigger my plugin when creating/debugging it.
I think @complexpoint answered the other points, but if not please post again. Getting the debugger working is key to plugin development.
Thanks for the answers.
I had the problem that in the debugger I could not find my plugin / file so I could not open it within the debugger to set breakpoints. The “debugger;” line worked of course. But there’s another way.
In the Resource tab I searched for a certain word I know I only have in my plugin. This showed the main.js from my plugin, which I could then open and set breakpoints.
As to invoking, I found out that I can execute commands in the console. From the API I learned that there was a perfomAction method in the Editor class. I could not invoke this by typing Editor.performAction() however. I figured maybe I’m in the context of Editor anyway and used this.performAction() which worked.
So now I only need to provide the function of how I named this plugin. I looked for the Extensions.addCommand function, where I define “name” and entered it. So in the console, I called this:
this.performAction(‘my name of the command’)
And it executed it. This way I didn’t need to learn how to make key bindings
So to summarize:
- Find the plugin you’re working on in the Resource tab by searching for a word within your plugin. You can then open it and set breakpoints. This is how you find your plugin in the debugger.
- Then, set a breakpoint somewhere.