Author Topic: Debug Environment for Scripts?  (Read 454 times)

Offline OldSkyEyes

  • Newcomer
  • Posts: 43
    • View Profile
Debug Environment for Scripts?
« on: 2019 January 28 10:50:34 »
How do you debug your script, just full run and then hope the error will guide you???

For small script try and error is ok but for large scripts I need to be able to set a breakpoint or something to see what is going on.

Offline RickS

  • PTeam Member
  • PixInsight Jedi
  • *****
  • Posts: 1295
    • View Profile
Re: Debug Environment for Scripts?
« Reply #1 on: 2019 January 28 23:03:42 »
Console.writeln debug messages are good enough for me.  IMO, sophisticated debuggers just encourage tinkering instead of thinking about the problem :)

Offline Juan Conejero

  • PTeam Member
  • PixInsight Jedi Grand Master
  • ********
  • Posts: 6716
    • View Profile
    • http://pixinsight.com/
Re: Debug Environment for Scripts?
« Reply #2 on: 2019 January 29 02:29:24 »
There is no JavaScript debugging environment in current versions of PixInsight. I plan on including one when I change the current JavaScript engine, but don't hold your breath.

I completely agree with Rick. I use debuggers in very rare occasions. Actually, I cannot remember the last time I used one with PixInsight, probably many years ago. If you develop good programming practices, style and skills, then a debugger cannot tell you anything you don't know, except in very special cases. The key is having full control on your code, not the opposite.
Juan Conejero
PixInsight Development Team
http://pixinsight.com/

Offline OldSkyEyes

  • Newcomer
  • Posts: 43
    • View Profile
Re: Debug Environment for Scripts?
« Reply #3 on: 2019 February 02 03:50:35 »
Sure it's easy when you know the libraries very well.
It's not always your own script you try to understand, many times you are just going to edit an existing one instead of starting from scratch.

Would it be possible to add IntelliSense in the PI Editor?
This would help a lot in knowing what is possible/correct and what not.

Maybe you can make some plug-in for Eclipse when you think about adding debugging features.

Offline aworonow

  • PixInsight Addict
  • ***
  • Posts: 238
    • View Profile
    • Faint Light Photography
Re: Debug Environment for Scripts?
« Reply #4 on: 2019 February 02 05:32:34 »
I agree with Mr. OldSkyEyes. I'm trying to write a small script, and am neither familiar with the PI library, nor with JavaScript. (I' bought 2 books on the latter.) Other than copying code from other scripts and hoping they are compatible, I'm at a loss for how to efficiently get to the end game. A rich-featured debugger would be a real head start.

Alex

Offline OldSkyEyes

  • Newcomer
  • Posts: 43
    • View Profile
Re: Debug Environment for Scripts?
« Reply #5 on: 2019 February 15 14:34:41 »
I just found the PJSR Object Explorer after I read you referring to it. :)
The existence of it should be made obvious in the script editor window and tab to auto complete?

Would be nice if extra info and example code was linked with the methods.
A bit like MS does on their website.  https://docs.microsoft.com/en-us/dotnet/api/system.drawing.image?view=netframework-4.7.2