[HELP] How to use breakpoint debugging when developing logseq plugins

Hi, I’m a new logseq user and I’m interested in developing some plugins for it. I wonder if it’s possible to use breakpoint debugging when developing logseq plugins. I have some experience with VSCode and JavaScript, but I’m not sure how to set up the debugging environment for logseq.

Can anyone share some tips or resources on how to debug logseq plugins? I would appreciate any help or guidance. Thank you!

I apologize for any mistakes, as I used a translator to help me write this post.

Welcome. Here are some options:

  • Make sure you have the debugger open (Ctrl + Shift + i).
  • Add a debugger statement somewhere in your code.
    • image
    • When the execution passes from there, the debugger should:
      • pause execution
      • show the respective code
      • pass you the control
      • look like this: image
    • Unfortunately, sometimes that statement is ignored.
  • Add a console.log statement somewhere in your code.
    • When the execution finishes, it should have printed the argument in the console.
    • At the top-right of that printing, there should be a link to the code: image
    • Follow the link to open the code.
    • Click on the desired line number to place a breakpoint: image
    • Next execution will pause at the breakpoint as if the debugger statement was given.