Debug a plugin written in JS

Oxygen general issues.
gbv34
Posts: 105
Joined: Thu Jan 20, 2022 12:36 pm

Debug a plugin written in JS

Post by gbv34 »

Hello everyone!
I have a plugin that was developed several years ago in javascript.
It contains a wsAccess.js, a toolbar.js and a plugin.xml file

I don't really get what is the purpose of the wsAccess.js knowing that most of the functions in it are similar to the toolbar.js.
The plugin.xml references both so I guess its author had a clear reason to do that.

However, now that I want to update it, I don't have any way to trace the errors that could occur. I update my js files and after restart my app. Sometimes, the effects are directly visible, sometimes they are not and the plugin doesn't fuction anymore.
I would like to trace and see more what happens in the background but the tutorials. have found are related to java and debugging in Eclipse and IntelliJ, they don't apply to plugins using javascript like those proposed in this folder.
https://github.com/oxygenxml/wsaccess-j ... ree/master

Would you have any tip, video or link to share so that I could better understand how my changes in the code apply or not in the plugin?
------
Gaspard
Radu
Posts: 9059
Joined: Fri Jul 09, 2004 5:18 pm

Re: Debug a plugin written in JS

Post by Radu »

Hi Gaspard,
How about if you start Oxygen using the "oxygen.bat" script from the Oxygen installation folder? The command prompt should show you the stack trace of all exceptions. You can also use "Packages.java.lang.System.err.println("test");" in the javascript code and it should show up in the console as well.
Other than that, if your plugin will grow in complexity in time maybe you can consider switching to using a Java based plugin instead.
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Post Reply